Raised This Month: $106 Target: $400
 26% 

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 , 13: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 , 13: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 , 15: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 02:01.


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