[Help] Mysql Error
#1

Hey guys

I'm quite new at Mysql and I cant find the error in this code,

I get this error here.
Код:
F:\Skrivbord\Skrivbord 3\Ny mapp\gamemodes\****.pwn(32928) : error 075: input line too long (after substitutions)
F:\Skrivbord\Skrivbord 3\Ny mapp\gamemodes\****.pwn(32929) : error 037: invalid string (possibly non-terminated string)
F:\Skrivbord\Skrivbord 3\Ny mapp\gamemodes\****.pwn(32929) : error 029: invalid expression, assumed zero
F:\Skrivbord\Skrivbord 3\Ny mapp\gamemodes\****.pwn(32929) : error 017: undefined symbol "houses"
F:\Skrivbord\Skrivbord 3\Ny mapp\gamemodes\****.pwn(32929) : fatal error 107: too many error messages on one line
This is the code
pawn Код:
new Query[1000];
        format(Query,sizeof(Query),"UPDATE `housesґ SET hEntrancex ='%f', hEntrancey ='%f', hEntrancez ='%f', hExitx ='%f', hExity ='%f', hExitz ='%f', hHealthx ='%d', hHealthy ='%d', hHealthz ='%d', hArmourx ='%d', hArmoury ='%d', hArmourz ='%d', hOwner ='%s', hDiscription ='%s', hValue ='%d', hHel ='%d', hArm ='%d', hInt ='%d', hLock ='%d', hOwned ='%d', hRooms ='%d', hRent ='%d', hRentabil ='%d', hTakings ='%d', hVec ='%d', hVcol1 ='%d', hVcol2 ='%d', hDate ='%d', hLevel ='%d', hWorld ='%d', hMats ='%d', hAddress ='%s', hAddress2 ='%d', WHERE HouseID ='%d'",
        HouseInfo[idx][hEntrancex],
        HouseInfo[idx][hEntrancey],
        HouseInfo[idx][hEntrancez],
        HouseInfo[idx][hExitx],
        HouseInfo[idx][hExity],
        HouseInfo[idx][hExitz],
        HouseInfo[idx][hHealthx],
        HouseInfo[idx][hHealthy],
        HouseInfo[idx][hHealthz],
        HouseInfo[idx][hArmourx],
        HouseInfo[idx][hArmoury],
        HouseInfo[idx][hArmourz],
        HouseInfo[idx][hOwner],
        HouseInfo[idx][hDiscription],
        HouseInfo[idx][hValue],
        HouseInfo[idx][hHel],
        HouseInfo[idx][hArm],
        HouseInfo[idx][hInt],
        HouseInfo[idx][hLock],
        HouseInfo[idx][hOwned],
        HouseInfo[idx][hRooms],
        HouseInfo[idx][hRent],
        HouseInfo[idx][hRentabil],
        HouseInfo[idx][hTakings],
        HouseInfo[idx][hVec],
        HouseInfo[idx][hVcol1],
        HouseInfo[idx][hVcol2],
        HouseInfo[idx][hDate],
        HouseInfo[idx][hLevel],
        HouseInfo[idx][hWorld],
        HouseInfo[idx][hMats],
        HouseInfo[idx][hAddress],
        HouseInfo[idx][hAddress2],
        idx);
        mysql_query(Query);
        mysql_store_result();
        idx++;
Thanks for the help!
Reply
#2

Bump...
Reply
#3

This means, that the line is to huge.
Reply
#4

how i see you forget to put ) on the end of the line :S
Reply
#5

You need to make it more than one line instead of that one long-ass line. If that doesn't work, format the query more than once.
Reply
#6

Quote:
Originally Posted by austin070
Посмотреть сообщение
You need to make it more than one line instead of that one long-ass line. If that doesn't work, format the query more than once.
Thanks, well I'v tried to format the query more than once, but I get the same problem...
Reply
#7

It should work.

pawn Код:
new Query[1000];
        format(Query,sizeof(Query),"UPDATE `housesґ SET hEntrancex ='%f', hEntrancey ='%f', hEntrancez ='%f', hExitx ='%f', hExity ='%f', hExitz ='%f', hHealthx ='%d', hHealthy ='%d', hHealthz ='%d', hArmourx ='%d', hArmoury ='%d', hArmourz ='%d', hOwner ='%s', hDiscription ='%s',",
        HouseInfo[idx][hEntrancex],
        HouseInfo[idx][hEntrancey],
        HouseInfo[idx][hEntrancez],
        HouseInfo[idx][hExitx],
        HouseInfo[idx][hExity],
        HouseInfo[idx][hExitz],
        HouseInfo[idx][hHealthx],
        HouseInfo[idx][hHealthy],
        HouseInfo[idx][hHealthz],
        HouseInfo[idx][hArmourx],
        HouseInfo[idx][hArmoury],
        HouseInfo[idx][hArmourz],
        HouseInfo[idx][hOwner],
        HouseInfo[idx][hDiscription]);
        format(Query,sizeof(Query),"%s hValue ='%d', hHel ='%d', hArm ='%d', hInt ='%d', hLock ='%d', hOwned ='%d', hRooms ='%d', hRent ='%d', hRentabil ='%d', hTakings ='%d', hVec ='%d', hVcol1 ='%d', hVcol2 ='%d', hDate ='%d', hLevel ='%d', hWorld ='%d', hMats ='%d', hAddress ='%s', hAddress2 ='%d', WHERE HouseID ='%d'",
        Query,
        HouseInfo[idx][hValue],
        HouseInfo[idx][hHel],
        HouseInfo[idx][hArm],
        HouseInfo[idx][hInt],
        HouseInfo[idx][hLock],
        HouseInfo[idx][hOwned],
        HouseInfo[idx][hRooms],
        HouseInfo[idx][hRent],
        HouseInfo[idx][hRentabil],
        HouseInfo[idx][hTakings],
        HouseInfo[idx][hVec],
        HouseInfo[idx][hVcol1],
        HouseInfo[idx][hVcol2],
        HouseInfo[idx][hDate],
        HouseInfo[idx][hLevel],
        HouseInfo[idx][hWorld],
        HouseInfo[idx][hMats],
        HouseInfo[idx][hAddress],
        HouseInfo[idx][hAddress2],
        idx);
mysql_query(Query);
        mysql_store_result();
        idx++;
Reply
#8

Yea the last one will get queried, the first one won't.

Here:

pawn Код:
new Query[1000];
        format(Query,sizeof(Query),"UPDATE `housesґ SET hEntrancex ='%f', hEntrancey ='%f', hEntrancez ='%f', hExitx ='%f', hExity ='%f', hExitz ='%f', hHealthx ='%d', hHealthy ='%d', hHealthz ='%d', hArmourx ='%d', hArmoury ='%d', hArmourz ='%d', hOwner ='%s', hDiscription ='%s',",
        HouseInfo[idx][hEntrancex],
        HouseInfo[idx][hEntrancey],
        HouseInfo[idx][hEntrancez],
        HouseInfo[idx][hExitx],
        HouseInfo[idx][hExity],
        HouseInfo[idx][hExitz],
        HouseInfo[idx][hHealthx],
        HouseInfo[idx][hHealthy],
        HouseInfo[idx][hHealthz],
        HouseInfo[idx][hArmourx],
        HouseInfo[idx][hArmoury],
        HouseInfo[idx][hArmourz],
        HouseInfo[idx][hOwner],
        HouseInfo[idx][hDiscription]);
mysql_query(Query);
        format(Query,sizeof(Query),"%s hValue ='%d', hHel ='%d', hArm ='%d', hInt ='%d', hLock ='%d', hOwned ='%d', hRooms ='%d', hRent ='%d', hRentabil ='%d', hTakings ='%d', hVec ='%d', hVcol1 ='%d', hVcol2 ='%d', hDate ='%d', hLevel ='%d', hWorld ='%d', hMats ='%d', hAddress ='%s', hAddress2 ='%d', WHERE HouseID ='%d'",
        Query,
        HouseInfo[idx][hValue],
        HouseInfo[idx][hHel],
        HouseInfo[idx][hArm],
        HouseInfo[idx][hInt],
        HouseInfo[idx][hLock],
        HouseInfo[idx][hOwned],
        HouseInfo[idx][hRooms],
        HouseInfo[idx][hRent],
        HouseInfo[idx][hRentabil],
        HouseInfo[idx][hTakings],
        HouseInfo[idx][hVec],
        HouseInfo[idx][hVcol1],
        HouseInfo[idx][hVcol2],
        HouseInfo[idx][hDate],
        HouseInfo[idx][hLevel],
        HouseInfo[idx][hWorld],
        HouseInfo[idx][hMats],
        HouseInfo[idx][hAddress],
        HouseInfo[idx][hAddress2],
        idx);
mysql_query(Query);
        mysql_store_result();
        idx++;
Reply
#9

Quote:
Originally Posted by Tee
Посмотреть сообщение
Yea the last one will get queried, the first one won't.
I think that you don't understand what I'm doing in the code.

You have to send only one query to the DB, you are sending two different queries that they are wrong:

You must send something like that: UPDATE tablename SET values WHERE condition.

1st. You are sending: UPDATE tablename SET values.
2nd. You are sending: values WHERE condition.

As you can see, in my code the first Query is added in the second one at the beginning, so both are at the same string/query.
Reply
#10

Oh, I didn't read the formated code.

Here, use this:

pawn Код:
new Query[1000];
        format(Query,sizeof(Query),"UPDATE `houses` SET hEntrancex ='%f', hEntrancey ='%f', hEntrancez ='%f', hExitx ='%f', hExity ='%f', hExitz ='%f', hHealthx ='%d', hHealthy ='%d', hHealthz ='%d', hArmourx ='%d', hArmoury ='%d', hArmourz ='%d', hOwner ='%s', hDiscription ='%s' WHERE HouseID ='%d'",
        HouseInfo[idx][hEntrancex],
        HouseInfo[idx][hEntrancey],
        HouseInfo[idx][hEntrancez],
        HouseInfo[idx][hExitx],
        HouseInfo[idx][hExity],
        HouseInfo[idx][hExitz],
        HouseInfo[idx][hHealthx],
        HouseInfo[idx][hHealthy],
        HouseInfo[idx][hHealthz],
        HouseInfo[idx][hArmourx],
        HouseInfo[idx][hArmoury],
        HouseInfo[idx][hArmourz],
        HouseInfo[idx][hOwner],
        HouseInfo[idx][hDiscription],
        idx);
mysql_query(Query);
        format(Query,sizeof(Query),"UPDATE `houses` SET %s hValue ='%d', hHel ='%d', hArm ='%d', hInt ='%d', hLock ='%d', hOwned ='%d', hRooms ='%d', hRent ='%d', hRentabil ='%d', hTakings ='%d', hVec ='%d', hVcol1 ='%d', hVcol2 ='%d', hDate ='%d', hLevel ='%d', hWorld ='%d', hMats ='%d', hAddress ='%s', hAddress2 ='%d' WHERE HouseID = %d",
        Query,
        HouseInfo[idx][hValue],
        HouseInfo[idx][hHel],
        HouseInfo[idx][hArm],
        HouseInfo[idx][hInt],
        HouseInfo[idx][hLock],
        HouseInfo[idx][hOwned],
        HouseInfo[idx][hRooms],
        HouseInfo[idx][hRent],
        HouseInfo[idx][hRentabil],
        HouseInfo[idx][hTakings],
        HouseInfo[idx][hVec],
        HouseInfo[idx][hVcol1],
        HouseInfo[idx][hVcol2],
        HouseInfo[idx][hDate],
        HouseInfo[idx][hLevel],
        HouseInfo[idx][hWorld],
        HouseInfo[idx][hMats],
        HouseInfo[idx][hAddress],
        HouseInfo[idx][hAddress2],
        idx);
mysql_query(Query);
        idx++;
And only use 'mysql_store_result' after using: SELECT, SHOW, DESCRIBE, EXPLAIN or CHECK TABLE query.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)