 Can some one help me out here?
I am receiving the following error when I run my script to connect and return simple results for my dB.
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\inetpub\wwwroot\sites\mapq1.PHP on line 77
Error line (77) is marked in red below.
Code:
//connect to the database server
$connection = mysql_connect($db_host, $db_username, $db_password) or die(mysql_error());
//select database
$db = mysql_select_db($db_name, $connection);
$sql="select regid,firstname from users";
$rs=mysql_query ($sql, $connection);
while( $row = mysql_fetch_array($rs) ) {
echo("user: ".$row["regid"]);
echo("-First Name: ".$rown["firstname"]."<br>");
}
?>
</body>
</html>
Can anyone see what I am doing wrong?
|