Hi! I'm completely new to all dev and trying to put a website together using MySQLI and PHP; was running fine until I try to gather the DB content with the following script:
getting the following error mesg when running it:
Warning: mysql_num_rows( ): supplied argument is not a valid MySQL result resource in /home/maxalien/public_html/davidloran/test/userCake/dbresult.php on line 12
Database Output
Let me know if you need more info and thx for your help
Code:
<?
$username="xxxxxx";
$password="xxxxxx";
$database="maxalien_davidloran";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM contacts";
$result=mysql_query($query);
$num=mysql_num_rows($result);
mysql_close();
echo "<b><center>Database Output</center></b><br><br>";
$i=0;
while ($i < $num) {
$username=mysql_result($result,$i,"username");
$password=mysql_result($result,$i,"password");
$email=mysql_result($result,$i,"email");
echo "<b>$first $last</b><br>Phone: $phone<br>Mobile: $mobile<br>Fax: $fax<br>E-mail: $email<br>Web: $web<br><hr><br>";
$i++;
}
?>
Warning: mysql_num_rows( ): supplied argument is not a valid MySQL result resource in /home/maxalien/public_html/davidloran/test/userCake/dbresult.php on line 12
Database Output
Let me know if you need more info and thx for your help
Comment