My request is working fine. but wen trying to get a unique value from mysql table fetch array does not work.
this is my sql A-2815 - vehicle item code. This field is unique. The expected result is the part detail Item_code A-2815.
$sql = "SELECT vehicle.id, item_code, make, model, vehicle_type, color, showroom_id, "; $sql .= "adding_user_Id, approved, image_1 "; $sql .= "FROM images, vehicle "; $sql .= "WHERE vehicle.id=images.item_id "; $sql .= "AND (item_code LIKE '%A-2815%' "; $sql .= "OR make LIKE '%A-2815%' "; $sql .= "OR model LIKE '%A-2815%' "; $sql .= "OR vehicle_type LIKE '%A-2815%' "; $sql .= "OR color LIKE '%A-2815%' "; $sql .= "OR showroom_id LIKE '%A-2815%') "; $sql .= "AND activate=1 "; $sql .= "AND type_of_image=1 ";
this is my php code.
<?php $query = mysql_query($sql); while($result = mysql_fetch_array($query)){ echo $result['item_code']; echo $result['make']; echo $result['model']; echo $result['vehicle_type']; echo $result['color']; echo $result['showroom_id']; } ?>
this works fine when the results are more than 1 row. but the problem is that the result is 1 line, then it does not work.
source share