Hi,
i am getting an error in my query ‘Warning: mysqli_stmt::bind_param(): Number of variables doesn’t match number of parameters in prepared statement in’
//query based on the lat long
$query_weather = "Select id, met_forecast.latitude,met_forecast.longitude, ( 3959 * acos( cos( radians('?') ) * cos( radians( met_forecast.latitude ) ) * cos( radians( met_forecast.longitude ) - radians('?') ) + sin( radians('?') ) * sin( radians( met_forecast.latitude ) ) ) ) AS distance From met_forecast
HAVING distance < 5 ORDER BY distance Limit 0,1";
// Setup parameter to be bound into query
//we've already set this in the above query
// Get instance of statement
$stmt_met = $gbgconn->stmt_init();
// Prepare Query
if($stmt_met->prepare($query_weather)){
// Bind Parameters
$stmt_met->bind_param("sss",$lat,$lng,$lat );
I can’t for the life of me see where i need to add an extra variable? i have 3 variable and i’ve added 3 ?s to the query. any ideas? is it something really stupid i am missing?
any help appreciated