Hi all i have a silly noob question....
When i directly query my database with the following i get the exact result i want.......
SELECT * FROM posts WHERE postTopic=3 AND postSubject=business;
However when i try this using the following PHP.......
$sql = "SELECT * FROM posts WHERE postTopic =" . mysql_real_escape_string($_GET['id']) . "AND postSubject='" . $_SESSION[forum] . "'";
I get no result
I also get the correct results from
$sql = "SELECT * FROM posts WHERE postTopic =" . mysql_real_escape_string($_GET['id']) . ";
and
$sql = "SELECT * FROM posts WHERE postSubject='" . $_SESSION[forum] . "'";
mysql_real_escape_string($_GET['id']) is an integer and $_SESSION[forum] is a string.
I know this has something to do with the manner in which the query is passed with the AND and the string but i can't for the life of my work out where i am going wrong.
Thanks for any help.