Linked Questions
9,698 questions linked to/from How can I prevent SQL injection in PHP?
3 votes
7 answers
40k views
PHP/mySQL: How do a concatenate a variable in a mysql query? [duplicate]
What is the proper way to concatenate text and a variable in PHP inside a mysql_query? Here is my attempt: page.'$pageID' I want it to output page3. Here is all of the code (simplified to focus on ...
8 votes
3 answers
13k views
Should I use mysqli_real_escape_string or should I use prepared statements? [duplicate]
Should I use mysqli_real_escape_string or should I use prepared statements? I've seen a tutorial now explaining prepared statements but I've seen them do the same thing as mysqli_real_escape_string ...
8 votes
2 answers
8k views
PHP/MySQL - Best use and practice of escaping strings [duplicate]
Possible Duplicate: Best way to prevent SQL Injection in PHP What is the best way to escape strings when making a query? mysql_real_escape_string() seems good but I do not exactly know how to use ...
2 votes
4 answers
9k views
prevent sql injection in mysqli [duplicate]
I am very new to mysqli earlier i am writing queries in mysql but mysqli is more advanced so, i am first time using it. Below is my php code. function clean($str) { $str = @trim($str); ...
3 votes
4 answers
6k views
Does json_encode() protect against SQL injections? [duplicate]
I noticed the function json_encode() automatically puts backslashes on " and ' values. I was originally protecting against SQL injections by using mysqli_real_escape_string($con, $value) before the ...
6 votes
2 answers
8k views
When Should I Use PHP mysqli_real_escape_string() Function? [duplicate]
I know that mysqli_real_escape_string Function can be used to prevent SQL injections. ( However, mysql_real_escape_string() will not protect you against some injections) My question is when should I ...
3 votes
3 answers
14k views
SQL Injection via URL parameter [duplicate]
I just saw in my webstats that someone appended a lot of SQL code to one url parameter. The URLs look like this: http://www.example.com/page.php?id=672%3f%20and%28select%201%20from%28select%20count%...
1 vote
4 answers
2k views
Make this query safe? [duplicate]
Possible Duplicate: Best way to stop SQL Injection in PHP I have seen some of examples that use something called a PDO to make a query safe from sql-infection, or others that use real_escape, but ...
2 votes
2 answers
5k views
Why mysql_real_escape_string returns boolean? [duplicate]
I have wrote a PHP script to handle user login. To prevent SQL Injection attack, I have used 'mysql_real_escape_string' function. Everything works good till today. I have traced code and finding the ...
-8 votes
3 answers
1k views
MySQL INJECTION Solution [duplicate]
I have been bothered for so long by the MySQL injections and was thinking of a way to eliminate this problem all together. I have came up with something below hope that many people will find this ...
1 vote
5 answers
65k views
php mysqli insert variables query [duplicate]
Ok so here is the question. I am trying to insert a variable into my query that is pre-defined. However it is not working. The query works if I just give it a value, but when I insert a variable into ...
-2 votes
5 answers
3k views
Is this PHP code vulnerable to SQL injection? [duplicate]
I have a website where I use PHP in server side and mysql as database. I use the following script to retrieve data from database. Could anybody let me know whether this code is vulnerable to injection ...
2 votes
4 answers
7k views
Secure against SQL Injection - PDO, mysqli [duplicate]
Possible Duplicate: Best way to prevent SQL Injection in PHP I just found that my website is vunerable. Since it's connected to a DB and have functions like: Register, Change Password, Notices, ...
2 votes
2 answers
4k views
why should use ATTR_EMULATE_PREPARES, is any alternatives of mysql_real_escape_string? in PDO [duplicate]
is there any alternatives in PDO as in mysql is mysql_real_escape_string? why we should set 'false' -> ATTR_EMULATE_PREPARES constant?
0 votes
4 answers
3k views
How to prevent mysql injection 1=1 using msqli? [duplicate]
Possible Duplicate: Best way to prevent SQL Injection in PHP In my website users can submit posts and delete their posts. To delete a post, they follow the link /posts.php?deletid=X where X is ...