Raised This Month: $12 Target: $400
 3% 

SQL_EscapeString help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NeXoU
Junior Member
Join Date: Jan 2014
Location: France
Old 06-27-2015 , 12:15   SQL_EscapeString help
Reply With Quote #1

Hello,

I need help for my MySQL query: when i want to save a sentence with ' , there is a problem with SQL_EscapeString (and i must use this to protect query).

PHP Code:
Format(sentencesizeof(sentence), "Hello! I'm a man!");

SQL_EscapeString(H_Databasesentencesentencesizeof(sentence)); 

new 
String:query[512]; 
Format(querysizeof(query), "INSERT INTO bdd_sentence(ID, Sentences) VALUES ('%d', '%s')"IDsentence); 

SQL_TQuery(H_DatabaseT_CheckSQLCallbackquery); 
In my database, i have: Hello! I///////////////

Thank you in advance
NeXoU is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 06-27-2015 , 12:48   Re: SQL_EscapeString help
Reply With Quote #2

You can't use the same buffer as both input and output, the output buffer also needs to be at least twice the size of the input.
__________________
asherkin is offline
NeXoU
Junior Member
Join Date: Jan 2014
Location: France
Old 06-27-2015 , 14:16   Re: SQL_EscapeString help
Reply With Quote #3

Quote:
Originally Posted by asherkin View Post
You can't use the same buffer as both input and output, the output buffer also needs to be at least twice the size of the input.
It's fix thank you again
NeXoU is offline
Reply


Thread Tools
Display Modes

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 14:09.


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