I have a simple database setup for practice and in it, it has 1 column called “id” and it’s set to type INTEGER. In this, I have only 1 number so far: 123.
I wanted to ensure that the database connection was working, so I did the following:
... $query = 'SELECT * FROM table'; $array = mysql_fetch_array(mysql_query($query)); print_r($array);
The print_r returned something unexpected (from my standpoint, that is). It returned the following:
Array (  => 123 [id] => 123 )
At first, I was confused because I kept thinking to myself that there should only be 1 item returned due to having stored only 1 number in the table. Does MySQL return 2 key/value pairs for each single item queried everything it returns a result set?
For example, if submitting 3 objects to be queried against some miscellaneous table, will it always return 6 result sets, etc? I guess I had originally only expected 1 single data item to be returned from my above example…
Thanks for any insight into this.