hi guys
i want escape string for query
how to this?
in mysql is mysql_real_escape_string
what is this in PDO?
thank you
1 reply to this topic
#1
Posted 27 August 2011 - 02:48 AM
|
|
|
#2
Posted 27 August 2011 - 05:36 AM
You can either either quote your data
Or you can prepare your sql
Here are one of the best tutorial for pdo that I read over the years: PHP Tutorials Examples Introduction to PHP PDO
$dbh->quote($string)when $dbh is your instance of pdo
Or you can prepare your sql
$sth = $dbh->prepare('select * from user where id=:id');
$sth->execute(array(':id' => $id));
This is one way to prepare your sql, in pdo you can prepare it in many wayHere are one of the best tutorial for pdo that I read over the years: PHP Tutorials Examples Introduction to PHP PDO
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









