My php source code is this and after run it shows the following error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\inetpub\wwwroot\farhadphp\examples\show.php on line 13
<?php
echo "<font face=tahoma size=1><center>";
$host="localhost";
$user="root";
$pwd="newpwd";
$db="users";
$tablen="users";
$link = mysql_connect($host,$user,$pwd);
mysql_select_db('$db');
$query='SELECT uname, password from $tablen';
$result=mysql_query($query,$link);
print ('<table bgcolor=#FFC0CB bordercolor=red width=50% border=1><tr align=center valign= top><td>Username</td><td>Password</td></tr>');
while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
print('<tr align=center valign=top><td>$row["uname"]</td><td>$row["password"]</td></tr>');
}
print ('</table>');
mysql_close ($link);
?>
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\inetpub\wwwroot\farhadphp\examples\show.php on line 13
<?php
echo "<font face=tahoma size=1><center>";
$host="localhost";
$user="root";
$pwd="newpwd";
$db="users";
$tablen="users";
$link = mysql_connect($host,$user,$pwd);
mysql_select_db('$db');
$query='SELECT uname, password from $tablen';
$result=mysql_query($query,$link);
print ('<table bgcolor=#FFC0CB bordercolor=red width=50% border=1><tr align=center valign= top><td>Username</td><td>Password</td></tr>');
while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
print('<tr align=center valign=top><td>$row["uname"]</td><td>$row["password"]</td></tr>');
}
print ('</table>');
mysql_close ($link);
?>