// if table is empty it must return TRUE, if full FALSE private function isEmpty($tableName) { if ($result = $this->mysqli->prepare("SELECT COUNT(*) FROM ?")) { $result->bind_param("s",$tableName); $result->execute(); $row_cnt = $result->num_rows; if (empty($row_cnt)) { return TRUE; } else { return FALSE; } } }
this code seems not a really perfect, I would like to know is there a better way to get the same results, but using predicat SQL EXISTS or something else? Thank you.