I have this script returning an array containing a row of values in a MySQL database table :
$player_login_request = $db->query('SELECT * FROM Players');
while ($player_login = $player_login_request->fetch())
{
print_r($player_login);
}
Here is the output of this script :
Array ( [id] => 2 [0] => 2 [name] => tom [1] => tom [experience] => 20 [2] => 20 [strength] => 30 [3] => 30 [damages] => 10 [4] => 10 )
It seems that the row of entries is doubled with some other columns named with some numbers. If you look at the structure of my table, the columns [0], [1], ..., [4] contain the same value than the previous columns (id, name, etc) but they shouldn't be there.
Here is the structure of the table if you are interested :
+------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(50) | YES | | NULL | |
| experience | int(11) | NO | | NULL | |
| strength | int(11) | NO | | NULL | |
| damages | int(11) | NO | | NULL | |
+------------+-------------+------+-----+---------+----------------+
5 rows in set (0.01 sec)
As you can see, when I do a SELECT * FROM Players in the command line, the columns are not displayed !
I don't understand the logic behind it. How do I get rid of it ?
I hope someone is here to help :P
Thank you in advance !