views:

1686

answers:

1

I have a table: 'objects' with few columns: object_id:int, object_type:int, object_status:int, object_lati:float, object_long:float My query is :

$stmt = $db->query('SELECT o.object_id, o.object_type, o.object_status, o.object_lati, o.object_long FROM objects o WHERE o.object_id = 1');
$res = $stmt->fetch();

Pdo throw error: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens When i remove column object_lati or object_long query is work fine.

A: 

Try the statement like:

$stmt = $db->query('SELECT object_id, object_type, object_status, object_lati, object_long FROM objects o WHERE object_id = ? ', 1);
robertbasic