i have a select query. another short if-form checks if this select query returns something or not.
so i have:
$query = "SELECT `a` FROM `b` WHERE c='$c'";
$test = ($query = mysql_query($query)) ? $mysql_num_rows($query) : 0;
so i would like to convert into mysqli but the following code seems to be wrong ($db = mysqli):
$query = "SELECT `a` FROM `b` WHERE c='$c'";
$test = ($query = $db->query($query)) ? $db->num_rows($query) : 0;
when using:
$test = ($query = mysqli_query($query)) ? mysqli_num_rows($query) : 0;
it will echo the error message:
Warning: mysqli_query() expects at least 2 parameters, 1 given...
so if there is someone who would be that friendly and could give me an advise to solve this i really would appreciate. thanks a lot.