MYSQL is not inserting
#1

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);
Reply
#2

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

Код:
[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?
Reply
#4

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)