18.09.2012, 13:37
Hey everyone,
I'm working on a MySQL system for my Vehicles, and I have done so each Vehicle that's loading updates it's cID to the ґvehicleidґ in samp, the thing is to get the cID to your keys, I mean if you have 2 cars you have 2 keys. What I want this code to do is to read each car by my name and load it's cID's to the keys, So far I only get the first cID to one of my Keys and the rest doesnt load at all...
Anyone know how to fix its?
Code:
Some how I only get the first cID in the first row where my name is listed....
Any ideas?
-Regards,
Tony
I'm working on a MySQL system for my Vehicles, and I have done so each Vehicle that's loading updates it's cID to the ґvehicleidґ in samp, the thing is to get the cID to your keys, I mean if you have 2 cars you have 2 keys. What I want this code to do is to read each car by my name and load it's cID's to the keys, So far I only get the first cID to one of my Keys and the rest doesnt load at all...
Anyone know how to fix its?
Code:
pawn Код:
new vString[900], vString2[900], idx = 0;
format(vString, sizeof(vString), "SELECT * FROM `vehicles` WHERE cOwner='%s' ORDER BY cID ASC", EscapedName);
mysql_query(vString2);
mysql_store_result();
new rows = mysql_num_rows();
mysql_free_result();
if(mysql_retrieve_row()) //data was retrieved
{
while (idx < rows)
{
if(idx == 0)
{
mysql_get_field("cID", vString);
PlayerInfo[playerid][pPcarkey] = strval(vString);
idx++;
}
else if(idx == 1)
{
mysql_get_field("cID", vString);
PlayerInfo[playerid][pPcarkey2] = strval(vString);
idx++;
}
else if(idx == 2)
{
mysql_get_field("cID", vString);
PlayerInfo[playerid][pPcarkey3] = strval(vString);
idx++;
}
else if(idx == 3)
{
mysql_get_field("cID", vString);
PlayerInfo[playerid][pPcarkey4] = strval(vString);
idx++;
}
else if(idx == 4)
{
mysql_get_field("cID", vString);
PlayerInfo[playerid][pPcarkey5] = strval(vString);
idx++;
}
}
mysql_free_result();
}
Any ideas?
-Regards,
Tony