SA-MP Forums Archive
MYSQL is not inserting - 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: MYSQL is not inserting (/showthread.php?tid=654221)



MYSQL is not inserting - idegod - 23.05.2018

Why this query is not inserting?

PHP код:
mysql_format(ConnectMYSQLquerysizeof(query), "INSERT INTO `mt` (`player`, `killers`, `date`) VALUES ('%d', '%s', '%s')"playeridstrkillersdatestr);
mysql_query(ConnectMYSQL,query); 
table
Код:
player int(11)
killers text
date varchar(20)
playerid = playerid

datestr
Код:
new datestr[128];
new Year, Month, Day;
getdate(Year, Month, Day);
format(datestr, sizeof(datestr), "%02d/%02d/%d", Day, Month, Year );
killers
...for:
Код:
                            new kstr[128];
                            if(killerid != INVALID_PLAYER_ID) {
                                printf("OI");
                                format(kstr, sizeof(kstr), "<a href='player.php?p=%s'>%s</a> ", PlayerName(killerid), PlayerName(killerid) );
                                printf("kstr: ", kstr);
                            }
after for
Код:
                            strcat(strkillers, kstr);



Re: MYSQL is not inserting - FailerZ - 23.05.2018

Check the logs, are there any errors?
I suspect it could be the size/length of the query string variable, try increase it if it is low.


Re: MYSQL is not inserting - idegod - 24.05.2018

Код:
[21:05:44] [ERROR] error #1064 while executing query "INSERT INTO `mt` (`player`, `killers`, `date`) VALUES ('110', '<a href='char.php?p=Indiny'>Indiny</a> ', '23/05/2018')": You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'char.php?p=Indiny'>Indiny</a> ', '23/05/2018')' at line 1 (CNR.pwn:2871 -> CNR.pwn:4618)
I didnt know about this logs, i search and found it, what i supposed to do?


Re: MYSQL is not inserting - GTLS - 24.05.2018

Change,

PHP код:
 format(kstrsizeof(kstr), "'<a href=player.php?p=%s>%s</a>'"PlayerName(killerid), PlayerName(killerid) ); 
and

PHP код:
 mysql_format(ConnectMYSQLquerysizeof(query), "INSERT INTO `mt` (`player`, `killers`, `date`) VALUES (%d, %s, '%s')"playeridstrkillersdatestr); 
mysql_query(ConnectMYSQL,query); 



Re: MYSQL is not inserting - idegod - 24.05.2018

Quote:
Originally Posted by GTLS
Посмотреть сообщение
Change,

PHP код:
 format(kstrsizeof(kstr), "'<a href=player.php?p=%s>%s</a>'"PlayerName(killerid), PlayerName(killerid) ); 
and

PHP код:
 mysql_format(ConnectMYSQLquerysizeof(query), "INSERT INTO `mt` (`player`, `killers`, `date`) VALUES (%d, %s, '%s')"playeridstrkillersdatestr); 
mysql_query(ConnectMYSQL,query); 
Thank you so much! +rep


Re: MYSQL is not inserting - Logic_ - 24.05.2018

Which version of MySQL are you using dude, you must make use of the threaded queries.