SA-MP Forums Archive
Mysql wont work? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Mysql wont work? (/showthread.php?tid=456081)



Mysql wont work? - thimo - 04.08.2013

Okay im using this code:
pawn Код:
public ClubCarTimer()
{
    new Query[128], rows, fields, i = 0, Day, Month, Year, Date[128];
    getdate(Year, Month, Day);
    format(Date, sizeof(Date), "%02d-%02d-%02d", Day, Month, Year);
    format(Query, sizeof(Query), "SELECT * FROM ClubCars");
    mysql_function_query( Handle, Query, false, "", "" );
    cache_get_data( rows, fields, Handle);
   
    while(rows > i < MAX_CLUBCARS)
    {
        cache_get_row(i, 3 , ClubVehicles[i][ExpireDate], Handle, 24);
        if(strmatch(ClubVehicles[i][ExpireDate], Date))
        {
       
        }
    }
    return 1;
}
But theres always a problem with the connection. Even though when i join mysql is used and runs fine.
This is the error:
[15:38:24] errorid: 2013 | error: "Lost connection to MySQL server during query" | callback: "" | query: "SELECT * FROM ClubCars" | connectionHandle: 1


Re: Mysql wont work? - Vince - 04.08.2013

You cannot immediately fetch the result after a threaded query is sent. That is the whole point of threading! Queries that return a result set (SELECT, SHOW, DESCRIBE) must use a callback.


Re: Mysql wont work? - thimo - 04.08.2013

Example? D: