Jump to content

bgyuk

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bgyuk's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. On second thoughts i think that part of the code is fine.
  2. Tried it and no joy. However it would not make sense to me if it did work as $_SESSION[forum] is the actual string value. also $sql = "SELECT * FROM posts WHERE postSubject='" . $_SESSION[forum] . "'"; works perfectly
  3. 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.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.