AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   SQL_EscapeString help (https://forums.alliedmods.net/showthread.php?t=265426)

NeXoU 06-27-2015 12:15

SQL_EscapeString help
 
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

asherkin 06-27-2015 12:48

Re: SQL_EscapeString help
 
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.

NeXoU 06-27-2015 14:16

Re: SQL_EscapeString help
 
Quote:

Originally Posted by asherkin (Post 2312789)
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


All times are GMT -4. The time now is 11:16.

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