result done by php with var_dump: 29
result done by phpmyadmin: 3
i do this in phpmyadmin:
SELECT * FROM tmp_foire_aux_vins_2012 WHERE 1 and prix_foire < 5 ORDER
BY enseigne ASC , prix_foire DESC
Why the return result is different than reality, the good result is 3
Here the code:
$query = "SELECT * FROM tmp_foire_aux_vins_2012 WHERE 1 $whereClause ORDER BY enseigne ASC $order";
$aRecordsListResultTab = $_SESSION["PDO"]->query($query, $param)->fetchALL(PDO::FETCH_OBJ);
$countResult = count($aRecordsListResultTab);
var_dump $param
array
0 => int 5
var_dump $whereClause
string ‘ and prix_foire < ?’ (length=19)
$query = "SELECT * FROM tmp_foire_aux_vins_2012 WHERE 1 and prix_foire < ? ORDER BY enseigne ASC , prix_foire DESC "
I solve the problem, in the DB, the type of the field was wrong…i change it to ‘decimal’, and it works like a charm