Jump to content

[SOLVED] Mysql_fetch_array problem with sql code


nvee

Recommended Posts

I get a mysql_fetch_array() expects parameter 1 to be resource, boolean given in .... error when I run the following code.

 

$q is passed to the page, and I have echoed it and returns a "3", which is what it is suppose to do. I cannot see what the problem is, everything else looks right. I predict it has to do with my sql query, but unless im missing something (which i am) I cannot see what the problem is :) Help anyone? :)

 

dbconnect($server,$dbuser,$dbpass,$db);
$query =mysql_query("SELECT * FROM city WHERE province_id = $q");
while ($result = mysql_fetch_array($query)) {
echo "<option value=\"" . $result["id"] . "\">" . $result["name"] . "</option>";
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.