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

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

Post Reply
RileyMorgan
Forum Newbie
Posts: 1
Joined: Tue Mar 01, 2011 4:05 pm

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

Post 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] =>
)
Last edited by RileyMorgan on Fri Mar 11, 2011 12:19 pm, edited 1 time in total.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Why does mysql_fetch_array() add more fields?

Post 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
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply