title: converting mysql into mysqli check for query
body: <p>i have a select query. another short if-form checks if this select query returns something or not.  </p>
  
  <p>so i have:</p>
  
  <pre><code>$query = "SELECT `a` FROM `b` WHERE c='$c'";
  $test = ($query = mysql_query($query)) ? $mysql_num_rows($query) : 0;
  </code></pre>
  
  <p>so i would like to convert into mysqli but the following code seems to be wrong ($db = mysqli):</p>
  
  <pre><code>$query = "SELECT `a` FROM `b` WHERE c='$c'";
  $test = ($query = $db-&gt;query($query)) ? $db-&gt;num_rows($query) : 0;
  </code></pre>
  
  <p>when using:</p>
  
  <pre><code>$test = ($query = mysqli_query($query)) ? mysqli_num_rows($query) : 0;
  </code></pre>
  
  <p>it will echo the error message:</p>
  
  <pre><code>Warning: mysqli_query() expects at least 2 parameters, 1 given...
  </code></pre>
  
  <p>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.</p>