PHP Prepared Statement Returns -1
Posted
by pws5068
on Stack Overflow
See other posts from Stack Overflow
or by pws5068
Published on 2010-03-30T22:53:48Z
Indexed on
2010/03/30
23:03 UTC
Read the original article
Hit count: 383
I've been using prepared statements for a little while now and I've never had any problems.
Now I'm trying to:
$sql="SELECT PhotoID,Caption FROM Photos WHERE EntityID=? AND TypeID=? LIMIT ?,?";
$iDB = new mysqliDB(); // Extends mysqli
$stmt = $iDB->prepare($sql);
$stmt->bind_param('iiii',$entityID,$typeID,$minRange,$maxRange);
$stmt->execute();
$stmt->bind_result($photoID,$caption);
echo("Affected={$stmt->affected_rows}");
This prints -1. I have triple tested that all 4 values in bindParam are set, and that the sql query works when pasted into myAdmin with the respective values.
Any idea what may be causing this?
© Stack Overflow or respective owner