Fetch_array: Invalid result resource

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Any suggestion as to why my fetch_array is bad?

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
result resource in /home/jkokko/public_html/ask/test.php on line 11
$dbHost = "localhost";
$dbUser = "user";
$dbPass = "pass";
$dbDatabase = "dbname";
//connet to the database
$db = mysql_connect("$dbHost", "$dbUser", "$dbPass") or die ("Error
connecting to database.");
mysql_select_db("$dbDatabase", $db) or die ("Couldn't select the

$result = "SELECT a_uid FROM `answers` WHERE `qid` = '13' LIMIT 0, 30,
while ($r = mysql_fetch_array($result)) {
echo $r;

Re: Fetch_array: Invalid result resource

Quoted text here. Click to load it

17 hours a day is too much. Changed the code to:

$result = "SELECT `a_uid` FROM `answers` WHERE `qid` = '13'";
$query = mysql_query($result, $db);
while ($item = mysql_fetch_array($query)) {
echo $item[a_uid];

and we now run ok..... I gotta get some sleep |-}

Site Timeline