AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   MySQL query failing if ' key is used [SOLVED] (https://forums.alliedmods.net/showthread.php?t=57187)

raa 06-30-2007 03:36

MySQL query failing if ' key is used [SOLVED]
 
If a person uses a name with the symbol/key ' in it, the persons data will not be saved to the database..

any ideas?

YamiKaitou 06-30-2007 14:20

Re: MySQL query failing if ' key is used
 
Show us the query you are using. You are obviously using the ' symbol within the query

raa 06-30-2007 14:35

Re: MySQL query failing if ' key is used
 
well yeah..

Code:

"INSERT INTO `%s` (authid, name, date) values('%s','%s',NOW()).................

so what its finally being read as is some incorrect statement and/or syntax



does anyone know for SURE if the code can be changed to(ie. take the ' symbols out)
Code:

"INSERT INTO `%s` (authid, name, date) values(%s,%s,NOW()).................
???

Or does some Trim function need to be setup?

raa 06-30-2007 19:37

Re: MySQL query failing if ' key is used
 
removing the ' characters from the query statement makes the query not work.

YamiKaitou 06-30-2007 19:50

Re: MySQL query failing if ' key is used
 
Try this

PHP Code:

replace_all(name,64,"'","/'"); 


raa 06-30-2007 20:06

Re: MySQL query failing if ' key is used
 
http://forums.alliedmods.net/showthr...ght=apostrophe


This works..

Code:

replace_all(name, 64, "'", "");

thanks for the reply.


All times are GMT -4. The time now is 21:26.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.