PHP PDO fetch null

Posted by Jacob on Stack Overflow See other posts from Stack Overflow or by Jacob
Published on 2010-05-18T09:29:40Z Indexed on 2010/05/18 9:30 UTC
Read the original article Hit count: 237

Filed under:
|
|
|

How do you check if a columns value is null? Example code:

$db = DBCxn::getCxn();

$sql = "SELECT exercise_id, author_id, submission, result, submission_time, total_rating_votes, total_rating_values
FROM submissions 
LEFT OUTER JOIN submission_ratings ON submissions.exercise_id=submission_ratings.exercise_id
WHERE id=:id";

$st = $db->prepare($sql);

$st->bindParam(":id", $this->id, PDO::PARAM_INT);

$st->execute();
$row = $st->fetch();

if($this->total_rating_votes == null) // this doesn't seem to work even though there is no record in submission_ratings????
{
...
}

© Stack Overflow or respective owner

Related posts about php

Related posts about pdo