PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
after_shox
Forum Newbie
Posts: 13 Joined: Wed Mar 10, 2004 11:53 am
Post
by after_shox » Sat May 22, 2004 12:49 pm
Having a bit of a headache with this
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"
after_shox
Forum Newbie
Posts: 13 Joined: Wed Mar 10, 2004 11:53 am
Post
by after_shox » Sat May 22, 2004 1:12 pm
cool it worked
But why ?
Thanks
Nay
Forum Regular
Posts: 951 Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia
Post
by Nay » Sat May 22, 2004 1:17 pm
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
after_shox
Forum Newbie
Posts: 13 Joined: Wed Mar 10, 2004 11:53 am
Post
by after_shox » Sat May 22, 2004 1:19 pm
nice one, thanks for everyones help