loading cars from mysql
#1

Код:
[17:20:11] ---------------------------
[17:20:11] MySQL Debugging activated (04/01/11)
[17:20:11] ---------------------------
[17:20:11] 
[17:20:11] >> mysql_query( Connection handle: 1 )
[17:20:11] CMySQLHandler::Query(SELECT * FROM `orgvehs`) - Successfully executed.
[17:20:11] >> mysql_store_result( Connection handle: 1 )
[17:20:11] CMySQLHandler::StoreResult() - Result was stored.
[17:20:11] >> mysql_retrieve_row( Connection handle: 1 )
[17:20:11] >> mysql_num_rows( Connection handle: 1 )
[17:20:11] CMySQLHandler::NumRows() - Returned 3 row(s)
[17:20:11] >> mysql_fetch_row_format( Connection handle: 1 )
[17:20:11] CMySQLHandler::FetchRow() - Return: 1|415|-296.60815|1575.80066|75.13008|135.73683|0|0|265
[17:20:11] >> mysql_retrieve_row( Connection handle: 1 )
[17:20:11] >> mysql_retrieve_row( Connection handle: 1 )
[17:20:11] >> mysql_free_result( Connection handle: 1 )
[17:20:11] CMySQLHandler::FreeResult() - Result was successfully free'd.
[17:20:11] ---------------------------
[17:20:11] MySQL Debugging de-activated
[17:20:11] ---------------------------
Код:
stock LoadOvehs()
{
	mysql_debug(1);
	new query[128];
    format(query,128,"SELECT * FROM `orgvehs`");
    mysql_query(query);
    mysql_store_result();
	while(mysql_retrieve_row())
        {
            new field[13][128],c1,c2;
            if(mysql_num_rows() == 0) continue;
            mysql_fetch_row_format(query, "|");
            explode(query, field, "|");
            new mdl,vidid,Float:x,Float:y,Float:z,Float:r;
            mdl=strval(field[1]);
            x=strval(field[2]);
            y=strval(field[3]);
            z=strval(field[4]);
            r=strval(field[5]);
            c1=strval(field[6]);
            c2=strval(field[7]);
            vidid=CreateVehicle(mdl,x,y,z+0.2,r,c1,c2,-1);
            vorg[vidid]=strval(field[0]);
            mysql_retrieve_row(1);
  		}
	mysql_free_result();
	mysql_debug(0);
	return 1;
}
thats how i load the vehicles from mysql but the thing is if there are 3 vehicles in the table atm only 1 loads from them.. please see the log, it just retrieves rows again and doesnt fetch them can you tell me whats goin on?
Reply
#2

you don't think this is causing an issue?
Код:
mysql_retrieve_row(1);
Reply
#3

same issue removing it. any suggestions?
Reply
#4

pawn Код:
stock LoadOvehs()
{
    mysql_debug(1);
    new
       query[128],
       field[13][128],
       c1,
       c2;
    mysql_query("SELECT * FROM `orgvehs`");
    mysql_store_result();
    if(mysql_num_rows() > 0)
    {
      while(mysql_fetch_row(query))
      {
            mysql_fetch_row_format(query, "|");
            explode(query, field, "|");
            new mdl,vidid,Float:x,Float:y,Float:z,Float:r;
            mdl=strval(field[1]);
            x=strval(field[2]);
            y=strval(field[3]);
            z=strval(field[4]);
            r=strval(field[5]);
            c1=strval(field[6]);
            c2=strval(field[7]);
            vidid=CreateVehicle(mdl,x,y,z+0.2,r,c1,c2,-1);
            vorg[vidid]=strval(field[0]);
      }
    }
    mysql_free_result();
    mysql_debug(0);
    return 1;
}
Try this.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)