this question has answer here:
i have no idea why not returning anything. i'll show code , talk through steps i've taken.
if (isset($_get['observation'])) { require_once("../func/connect.php"); $query = "select * observations option = ?"; $stmt = $db->prepare($query); $stmt->bindvalue(1, $_get['observation']); $stmt->execute(); $row = $stmt->fetch(pdo::fetch_assoc); echo $row['question']; } else { echo 'nope'; } $row dumps false boolean, $row['question'] null.
i've wrote million queries , don't have clue why doesn't work.
database table observations consists of id, question & option , bindvalue correct match string in database.
however, returns null.
option reserved word in mysql need quote backticks:
$query = "select * observations `option` = ?";
Comments
Post a Comment