How to get data in PDO with 2 conditions parenthesis
HERE is the normal sql
$q= mysql_query("SELECT c_id FROM conversation WHERE (user_one='$user_one'
and user_two='$user_two') or (user_one='$user_two' and
user_two='$user_one') ") or die(mysql_error());
I want to do it in PDO way but can not get the same result. I have use PDO
fo rmany project but not with 2 2 conditions parenthesis like this.
I have tried
$q = $conn->prepare("SELECT c_id FROM conversation WHERE (user_one=? and
user_two=?) or (user_one=? and user_two=?) ");
$q->execute(array($user_one, $user_two, $user_two, $user_one));
But it doesn´t work.
Ps I get no error, just can not get the same result.
Recently, I have commenced a blog the info you give on this site has encouraged and benefited me hugely. Thanks for all of your time & work. v lift thread
ReplyDelete