MySQL Query not completing
#1

I couldn't put the whole query in to one line as I got an error, I do this and it only inserts the data up to "Rank4Name".

pawn Код:
new string[256];
    format(string, sizeof(string), "INSERT INTO groups (ID,Name,Rank1Name,Rank2Name,Rank3Name,Rank4Name) VALUES ('%d','%s','%s','%s','%s','%s')", rows += 1, GroupCreating[playerid][Name], GroupCreating[playerid][Rank1Name], GroupCreating[playerid][Rank2Name], GroupCreating[playerid][Rank3Name], GroupCreating[playerid][Rank4Name]);
    mysql_query(string);

    format(string, sizeof(string), "INSERT INTO groups (Rank5Name,Rank6Name,Rank7Name,Rank8Name,JoinRank) VALUES ('%s','%s','%s','%s','%d') WHERE Name='%d'", GroupCreating[playerid][Name], GroupCreating[playerid][Rank5Name], GroupCreating[playerid][Rank6Name], GroupCreating[playerid][Rank7Name], GroupCreating[playerid][Rank8Name], GroupCreating[playerid][JoinRank]);
    mysql_query(string);
Reply
#2

Check your MySQL error log file.
Reply
#3

Mind telling me where to find that? I'll have a look but this is the first time I've ever touched SQL.
Reply
#4

WHERE Name='%d'"


Your name is an integer ?
Reply
#5

Dice, that hasn't fixed it.
Reply
#6

Could you show the (formated) queries and any errors in your error log ?
Reply
#7

Which MySQL plugin are you using?
Reply
#8

I am using G-Stylezzz' plugin. I have edited my queries to these:
pawn Код:
format(string, sizeof(string), "INSERT INTO groups (ID,Name,Rank1Name,Rank2Name,Rank3Name,Rank4Name) VALUES (%d,'%s','%s','%s','%s','%s')", groupID, GroupCreating[playerid][Name], GroupCreating[playerid][Rank1Name], GroupCreating[playerid][Rank2Name], GroupCreating[playerid][Rank3Name], GroupCreating[playerid][Rank4Name]);
    mysql_query(string);

    format(string, sizeof(string), "INSERT INTO groups (Rank5Name,Rank6Name,Rank7Name,Rank8Name,JoinRank) VALUES ('%s','%s','%s','%s',%d)", GroupCreating[playerid][Rank5Name], GroupCreating[playerid][Rank6Name], GroupCreating[playerid][Rank7Name], GroupCreating[playerid][Rank8Name], GroupCreating[playerid][JoinRank]);
    mysql_query(string);
And now it splits like so:
Reply
#9

What types for your fields did you set?
Reply
#10

What if you use the 'UPDATE' syntax for the second query?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)