mysql_fetch_array() expects parameter 1 to be resource, string given in C:\xampp

<!doctype html>

Pagination <?php $con=mysql_connect("localhost","root",""); mysql_select_db("paging",$con); $res=("select * from paging"); if($res === FALSE) { die(mysql_error()); // TODO: better error handling } while($row=mysql_fetch_array($res)) { echo $row["id"]," ", $row["name"]; echo "
"; } ?>

[php]$res=(“select * from paging”);[/php]

This sets a string variable.

Did you mean
[php]$res=$mysqli->query(“select * from paging”);[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service