Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Troubleshooting (MySQL in PHP)

Status
Not open for further replies.

Kaelri

Programmer
Feb 10, 2004
1
US
<?php
if($_SESSION['user']){
$password=&quot;joshua&quot;;
$host=&quot;ecomm1.csug.rochester.edu&quot;;
$user=&quot;arms&quot;;
$link=mysql_connect($host,$user,$password);
$q=&quot;SELECT * FROM threads ORDER BY lpost LIMIT='30'&quot;;
$r=mysql_db_query(&quot;lore&quot;,$q,$link);
while($row=mysql_fetch_array($r)){ (<<< Line 68)
$id = $row['0'];
$topic = $row['1'];
$author = $row['2'];
$fpost = $row['3'];
$lpost = $row['4'];
$lauthor = $row['5'];
$replies = $row['6'];
print(&quot;<tr><td valign=\&quot;top\&quot;>&nbsp;<td valign=\&quot;top\&quot;><a href=\&quot;thread.php?thread=$id\&quot;>$topic</a><td valign=\&quot;top\&quot;>$author<br><i><font size=\&quot;-1\&quot; color=\&quot;#AAAAAA\&quot;>$fpost</font><td valign=\&quot;top\&quot;>$replies<td valign=\&quot;top\&quot;>$lauthor<br><font size=\&quot;-1\&quot; color=\&quot;#AAAAAA\&quot;><i>$lpost</i>&quot;);
}
}
?>

Returned on-page error: &quot;Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/arms/public_html/lore/mb/index.php on line 68&quot;

IF you have any offerings of help, please share them.
 
I think the error is the query, not the fetch_array. try the script replacing the line:

$r=mysql_db_query(&quot;lore&quot;,$q,$link);

with:

$r=mysql_db_query(&quot;lore&quot;,$q,$link) or die (&quot;Error: &quot; . mysql_error());

you will see if the query has an error.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top