SA-MP Forums Archive
Issue with SQL - 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: Issue with SQL (/showthread.php?tid=435688)



Issue with SQL - UnknownGamer - 08.05.2013

pawn Код:
public LoadCar()
{
    new file[26];
    for(new idx = 1; idx < sizeof(CarInfo) ; idx++)
    {
        format(file,sizeof(file),"SELECT `ownedcars` WHERE `id` = '%d'", idx);
        mysql_query(file);
        if(mysql_query(file))
        {
            CarInfo[idx][cModel] = mysql_query(file,"Model");
Error is on: CarInfo[idx][cModel] = mysql_query(file,"Model");

Can you tell me, what did I do wrong, looks ok to me?

error 035: argument type mismatch (argument 2)


Re: Issue with SQL - Scenario - 08.05.2013

Go read some tutorials on using MySQL. Also note that your string "file" is too short. The query itself is 36 characters long, you need a string of at least 40 to account for the possible ID's and the null terminator.


Re: Issue with SQL - MP2 - 08.05.2013

You're seriously going to send a SELECT query for every single vehicle..? You're also sending the same query twice, and a third time you're sending the query "Model" (which isn't even a query).

As RealCop said, don't try and guess how to use mySQL - go read a tutorial, go download a mySQL-based gamemode or something, just don't do that..