25.02.2010, 12:20
Hey, any time there. I'm having trouble downloading data from MySQL. I want to let you type commands from levying all things to the table if they are assigned to the player ID. Query looks like this: "SELECT * FROM test WHERE uid = (player uid here)". My table structure looks something like this:
+----+-----+-------+
| id | uid | name |
+----+-----+-------+
| 6 | 1 | Item1 |
| 7 | 1 | Item2 |
| 8 | 1 | Item3 |
| 9 | 1 | Item4 |
| 10 | 1 | Item5 |
+----+-----+-------+
The game should look like this:
[ID: 6] Item1
[ID: 7] Item2
[ID: 8] Item3
[ID: 9] Item4
[ID: 10] Item5
But it looks so:
Does not display the name
Code:
+----+-----+-------+
| id | uid | name |
+----+-----+-------+
| 6 | 1 | Item1 |
| 7 | 1 | Item2 |
| 8 | 1 | Item3 |
| 9 | 1 | Item4 |
| 10 | 1 | Item5 |
+----+-----+-------+
The game should look like this:
[ID: 6] Item1
[ID: 7] Item2
[ID: 8] Item3
[ID: 9] Item4
[ID: 10] Item5
But it looks so:
Does not display the name
Code:
Код:
if(mysql_num_rows() > 0) { SendClientMessage(playerid,White,"All:"); while(mysql_fetch_row(result)) { explode(row,result,"|"); format(string,sizeof(string),"[ID: %d] %s",strval(row[0]),strval(row[2])); SendClientMessage(playerid,WHITE,string); } } else { SendClientMessage(playerid,WHITE,"Empty!"); }