Hi guys,
I have a little code below that seems to keep returning the errors:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/site.com/pics.php on line 70
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/www/site.com/pics.php on line 84.
When I remove the WHERE statement (highlighted in bold below) it all works and the tables are set up correctly. Whats going on and How do I fix it?
Thanks.
<?php
require("databaseconnect.php");
mysql_select_db($dbase, $connect);
[B]$results = mysql_query("SELECT * FROM `pics` WHERE username='".$username."' LIMIT 1") or die(mysql_error());[/B]
$ressource = mysql_query($results,$connect);
$ressource = mysql_query($results,$connect);
$num_rows = mysql_num_rows($ressource);
?>
<Br>
<table cellpadding=3 border="1">
<tr><td>Preview</td><td>Name</td><td>URL</td><td>Username</td></tr>
<?php
require("databaseconnect.php");
while ($row = mysql_fetch_array($ressource, MYSQL_NUM)) {
printf("<tr><td><img height=150 width=150 src=%s></td><td>%s</td><td><a href=%s>%s</a></td><td>%s</tr>", $row[2], $row[1], $row[2], $row[2], $row[0]);
}
?>