Raised This Month: $ Target: $400
 0% 

MySQL query failing if ' key is used [SOLVED]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
raa
Senior Member
Join Date: Oct 2005
Old 06-30-2007 , 03:36   MySQL query failing if ' key is used [SOLVED]
Reply With Quote #1

If a person uses a name with the symbol/key ' in it, the persons data will not be saved to the database..

any ideas?
__________________

Last edited by raa; 06-30-2007 at 20:07.
raa is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-30-2007 , 14:20   Re: MySQL query failing if ' key is used
Reply With Quote #2

Show us the query you are using. You are obviously using the ' symbol within the query
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
raa
Senior Member
Join Date: Oct 2005
Old 06-30-2007 , 14:35   Re: MySQL query failing if ' key is used
Reply With Quote #3

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?
__________________

Last edited by raa; 06-30-2007 at 14:38.
raa is offline
raa
Senior Member
Join Date: Oct 2005
Old 06-30-2007 , 19:37   Re: MySQL query failing if ' key is used
Reply With Quote #4

removing the ' characters from the query statement makes the query not work.
__________________
raa is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-30-2007 , 19:50   Re: MySQL query failing if ' key is used
Reply With Quote #5

Try this

PHP Code:
replace_all(name,64,"'","/'"); 
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
raa
Senior Member
Join Date: Oct 2005
Old 06-30-2007 , 20:06   Re: MySQL query failing if ' key is used
Reply With Quote #6

http://forums.alliedmods.net/showthr...ght=apostrophe


This works..

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

thanks for the reply.
__________________
raa is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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