Page 1 of 1

Where select

Posted: Sat May 22, 2004 12:49 pm
by after_shox
Having a bit of a headache with this :roll:

Code: Select all

<?php
			
mysql_pconnect("localhost","**********","******");
mysql_select_db("douple_Newdata");
$result = mysql_query("select * from counter where id='3'");
mysql_fetch_array($result);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
extract ($row);
echo "$count";



?>
but if i take where id='3' out of the query it works? Even though there is a "3" id in the table.

i get this error: "extract(): First argument should be an array"

Posted: Sat May 22, 2004 12:51 pm
by Illusionist
try taking this line out:

Code: Select all

mysql_fetch_array($result);

Posted: Sat May 22, 2004 1:12 pm
by after_shox
cool it worked :wink: But why ?

Thanks

Posted: Sat May 22, 2004 1:17 pm
by Nay

Code: Select all

mysql_fetch_array($result);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
It's because mysql_fetch_array() was occuring twice. Which it shouldn't. On the note, you can also do:

Code: Select all

$row = mysql_fetch_assoc($result);
-Nay

Posted: Sat May 22, 2004 1:19 pm
by after_shox
nice one, thanks for everyones help :)