SA-MP Forums Archive
Anyone see anything wrong with this? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Anyone see anything wrong with this? (/showthread.php?tid=178631)



Anyone see anything wrong with this? - ihatetn931 - 23.09.2010

Does anyone see anything wrong with this query, I can't figure it out.

pawn Код:
new Query[128];
        format(Query, sizeof(Query), "INSERT INTO vehicles (Model,ParkX,ParkY,ParkZ,ParkA,Color1,Color2,VehicleOwner,VehicleDescription,Owned,Locked,LockBought,RentPrice,Alarm,VehKey,PaintJob,Insurance,Scratches) VALUES ('%d','%f,'%f','%f','%f','%d','%d','%s','%s','%d','%d','%d','%d','%d','%d','%d','%d','%d')",
        VehicleInfo[car][vCarId],
        VehicleInfo[car][vModel],
        VehicleInfo[car][vX],
        VehicleInfo[car][vY],
        VehicleInfo[car][vZ],
        VehicleInfo[car][vAngle],
        VehicleInfo[car][vColorOne],
        VehicleInfo[car][vColorTwo],
        VehicleInfo[car][vOwner],
        VehicleInfo[car][vDescription],
        VehicleInfo[car][vOwned],
        VehicleInfo[car][vLock],
        VehicleInfo[car][vLockBuyed],
        VehicleInfo[car][vRentPrice],
        VehicleInfo[car][vAlarm],
        VehicleInfo[car][vKey],
        VehicleInfo[car][vPaintJob],
        VehicleInfo[car][vInsurances],
        VehicleInfo[car][vScratches]);
        mysql_query(Query);
        printf("%s",Query);
In the mysql Log
Код:
[09/22/10 22:44:54] Error (0): Could not execute query. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1.



Re: Anyone see anything wrong with this? - RSX - 23.09.2010

pawn Код:
('%d','%f,'%f','%f','%f','%d','%d','%s','%s','%d','%d','%d','%d','%d','%d','%d','%d','%d')
This seems to be wrong


Re: Anyone see anything wrong with this? - ihatetn931 - 23.09.2010

Fixed it and it still seems to give me the same issue. Was dumb of me not to catch that.

pawn Код:
('%d','%f','%f','%f','%f','%d','%d','%s','%s','%d','%d','%d','%d','%d','%d','%d','%d','%d')

This is what shows up in the serverlog

Код:
[22:53:31] MySQL Error (0): Could not execute query. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1.
[22:53:31] INSERT INTO vehicles (Model,ParkX,ParkY,ParkZ,ParkA,Color1,Color2,VehicleOwner,VehicleDescription,Owned,Locked,LockBought,RentP
[22:53:31] Test_User bought a Buffalo.



Re: Anyone see anything wrong with this? - Zeex - 23.09.2010

You're trying to place a string in the Query much bigger than its size, so it's not fully copied in there, hence syntax error


Re: Anyone see anything wrong with this? - ihatetn931 - 23.09.2010

Quote:
Originally Posted by Zeex
Посмотреть сообщение
You're trying to place a string in the Query much bigger than its size, so it's not fully copied in there, hence syntax error
Thank you, I always thought the size of the string is the amount of charcters is was capturing, I set it to 512 and it seems to be working