How do I check if my statement is empty? The below code just show nothing if the Join contains nothing. How do i get it to display the first part of my IF statement ( Your To-Do List is Empty! )?
<?php
$statement = $db->query('SELECT * FROM todo_item as ti INNER JOIN todo_category as tc ON ti.todo_id = tc.todo_id');
if (empty($db))
{
echo "<p style='background-color:green;'><strong>Your To-Do List is Empty!</strong></p>";
}
else
foreach($statement as $row):
?>
Are you using PDO?
PDOStatement::rowCount