PDO with placeholders with AND clause

Posted in CategoryGeneral Discussion
  • Terry Ogbemudia 4 months ago
    Why using query and execute ? I will change query to prepare and try again 
  • Hder 5 months ago

    Can you tell me the proper syntax for this PDO query?  I seem to be getting syntax errors on the first line.

    PROBLEM QUERY:

    $stmt = $db->query("SELECT * FROM flags WHERE postID = ? AND userID = ?");
    $stmt->execute([$_POST['postID'],$_POST['userID']]);
    $row = $stmt->fetch();

Please login or register to leave a response.