I'm getting this PHP Warning when im trying to register something on the companies website I work for. I didnt write this code so I'm not too sure what's going on but this is the error im getting - Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/mojo/public_html/warranty/warranty_reg_get_my_stock.php on line 16
and this is the code
<?php
include('conf.php');
$dealer_id = $_SESSION['dealer_id'];
$start_vin = $_GET['vin'];
$query = "SELECT customer_id FROM dealers_myob WHERE dealer_id = ".$dealer_id;
$result = mysql_query($query);
$array = mysql_fetch_array($result);
$customer_id = $array['customer_id'];
$query = "SELECT vin FROM mojo_myob.vins WHERE customer = ".$customer_id." AND registered = 0 AND vin LIKE '".$start_vin."%' ORDER BY vin ASC";
$result = mysql_query($query);
if(mysql_num_rows($result)) {
$vins = '<select id="my_stock_select" size="7" onclick="copyVIN(this.value);" onchange="copyVIN(this.value);">';
while($array = mysql_fetch_array($result)) {
//check to see if registered, if not, show entry
$current_vin = str_replace(" ", "", $array['vin']);
$current_vin = str_replace("-", "", $current_vin);
$reg_query = "SELECT * FROM warranty_registration WHERE frame_num LIKE '".$current_vin."'";
$reg_result = mysql_query($reg_query);
$reg_count = mysql_num_rows($reg_result);
if(!$reg_count) {
//does not exist, so show the entry
$vins .= ' <option value="'.$current_vin.'">'.$current_vin.'</option>';
}
}
$vins .= '</select>';
echo $vins;
} else {
$vins = '<select id="my_stock_select" size="7">';
$vins .= ' <option value="">:::no vins found:::</option>';
$vins .= '</select>';
echo $vins;
}
?>
Row #16 is if(mysql_num_rows($result)) { Any help is appreciated, thank you so much!