Anyone see anything wrong with this?
#1

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.
Reply
#2

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

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.
Reply
#4

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
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)