I try to create an if / else action, based on the number of rows in my DB.
$gekoppeldeDB = $_POST['gekoppeldeDB'];
$sql_bon = mysqli_query($mysqli, "SELECT * FROM $gekoppeldeDB");
$rowcount = mysqli_num_rows($sql_bon);
echo ($rowcount);
when there's 1 (or more) row everything works just fine. But when the DB is empty, an error gets printed on my screen:
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /home/deb22994/domains/entertainyou.nl/public_html/dichtbij/verkopen_afhandelen.php on line 25
Such a small and easy (should be at least) piece of code, what am I missing? Why doesn't it echo just 0 when the DB is empty?