Hi,
I'm trying to go through a tutorial on PHP + mySQL here.
It's working fine until I get to the line
where I get the error message
Soo... is there a fault in the tutorial? Or did I do something else wrong? Here's a copy of all of my code:
I'm trying to go through a tutorial on PHP + mySQL here.
It's working fine until I get to the line
PHP:
$num=mysql_numrows($result);
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/flaatartist/www/page1/page1.php on line 81
Soo... is there a fault in the tutorial? Or did I do something else wrong? Here's a copy of all of my code:
PHP:
<?php
$username="myusername";
$password="mypassword";
$database="flaatartist";
mysql_connect("mysqldatabase",$username,$password);
@mysql_select_db($database) or die("error connecting to database");
mysql_query("INSERT INTO contacts VALUES ('Erlend','Handeland')");
$query="SELECT * FROM contacts";
$resulr=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "<b>Database</b><br><br>";
$i=0;
while ($i < $num) {
echo "Navn: <b>$fornavn $etternavn</b><br>";
$i++;
$fornavn=mysql_result($result,$i,"fornavn");
$etternavn=mysql_result($result,$i,"etternavn");
}
?>