title: Selecting MySQL query via PHP variables
body: <p>I am getting zero in <code>$booked_num</code>, I tried the query in SQL with values in place of variables, it worked fine. But I don't know where I am making a mistake, please help.
  I already echoed every variable and everything is fine, but nothing is there in <code>$booked_row</code>and <code>$booked_num</code> is echoing zero.</p>
  
  <pre><code>require_once 'mysql_connector.php';
  $booked_result = mysql_query('select * from booked where train_no = ".$train_no." and date = ".$date." and st_from = ".$st_from." and st_to = ".$st_to.";') or die(mysql_error()) ;
  $booked_num = mysql_num_rows($booked_result);
  echo $booked_num;
  $booked_row = mysql_fetch_array($booked_result,MYSQL_ASSOC);
  print_r($booked_row);
  </code></pre>