Page 1 of 1

SOLVED--Why does mysql_fetch_array() add more fields?

Posted: Fri Mar 11, 2011 11:20 am
by RileyMorgan
Thanks for clicking... This is my 1st post. Usually I figure it out on my own. This one has me stumped.

When I do.

Code: Select all

for($p=0;$p<=count($arraycurrentstore)-1;$p++){
$qry_raw_functionality = "SELECT    *      FROM    functiondisplays        WHERE       store='$arraycurrentstore[$p]'";
$qry_received_functionality = mysql_query($qry_raw_functionality,$dblink);
$arrayoffunctionality = mysql_fetch_array($qry_received_functionality);
Yes I am missing alot. You don't need it though..

But why do I get the fields 0 1 2 3 4 5 6 7 8 9 10 11 12
Even though the database only has named fields.
Right now I can unset() the ones I don't need. but when users add more fields it could get really messy.
Array
(
[0] => 4
[index] => 4
[1] => 0459
[store] => 0459
[2] => 1
[gaming_xbox_endcap_tv] => 1
[3] => 1
[gaming_xbox_endcap_xbox] => 1
[4] => n
[gaming_xbox_endcap_controller1] => n
[5] => 1
[gaming_xbox_endcap_controller2] => 1
[6] => 1
[gaming_wii_endcap_tv] => 1
[7] => 1
[gaming_wii_endcap_wii] => 1
[8] => 1
[gaming_wii_endcap_controller] => 1
[9] => 1
[gaming_wii_endcap_nunchuck] => 1
[10] => 1
[gaming_wii_endcap_fan] => 1
[11] => 1
[gaming_wii_endcap_light] => 1
[12] =>
[blah] =>
)

Re: Why does mysql_fetch_array() add more fields?

Posted: Fri Mar 11, 2011 12:06 pm
by AbraCadaver
Read what mysql_fetch_array() returns, the args you can pass to it and the "see also" functions: http://us.php.net/mysql_fetch_array