Jump to content

why does my query array look like this?


GSP

Recommended Posts

In my database, I have five fields: id, name, option1, option2, and option3. When I query the database and print_r the array, I get:

Array (

[0] => 4

[id] => 4

[1] => carley

[name] => carley

[2] => no

[option1] => no

[3] => no

[option2] => no

[4] => yes

[option3] => yes )

 

Why is it that each field gets a separate name and reprint the value? How do I get it to look like this?:

Array (

[id] => 4

[name] => carley

[option1] => no

[option2] => no

[option3] => yes

)

Link to comment
https://forums.phpfreaks.com/topic/190265-why-does-my-query-array-look-like-this/
Share on other sites

the manual offers the answer: mysql_fetch_array

 

the function will return an array with both numerical and string indexes for each column. use the optional $result_type flag to restrict it to one type or the other.

the manual offers the answer: mysql_fetch_array

 

the function will return an array with both numerical and string indexes for each column. use the optional $result_type flag to restrict it to one type or the other.

Doh!  :-[

 

Thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.