[eluser]zulubanslee[/eluser]
This function works if I hard code the values at the bottom of the query. I can confirm that the values are being passed via the parameters. But when I put in the question marks, it stops working. Am I making some foolish error?
Code:
function get_this_vehicle_info($ad_id, $user_id)
{
$sql = "SELECT
users.id AS user_id,
ads.id AS ad_id,
ads.year,
ads.price,
ads.mileage,
ads.transmission,
ads.description,
ads.city,
ads.state,
ads.zip_code,
ads.phone,
vehicle_type.vehicle_type,
vehicle_make.vehicle_make,
vehicle_model.vehicle_model,
vehicle_images.image_name
FROM ads, vehicle_images, users, vehicle_type, vehicle_make, vehicle_model
WHERE ads.vehicle_type = vehicle_type.id AND
ads.vehicle_make = vehicle_make.id AND
ads.vehicle_model = vehicle_model.id AND
vehicle_images.fk_ad_id = ads.id AND
ads.id = ? AND
users.id = ?";
//$query = $this->db->query($sql, array('ads.id', 'users.id'));
$query = $this->db->query($sql, array('ad_id', 'user_id'));
if($query->num_rows() > 0)
return $query;
else
return FALSE;
}