I'm working on a project where I need to set the boolean value isHere to true(1) when it finds the corresponding ID. However I can't seem to update the database. I can select from the database though.
I have two problems. First:
$handle = @fopen("../smartriders.txt", "r");
if ($handle)
{
while (($smartRider = fgets($handle, 255)) !== false)
{
if($update = $conn->query("UPDATE members SET isHere = 1 WHERE SmartRiderID = ?", $smartRider))
{
print("update successful");
}
}
if (!feof($handle)) {
echo "Error: unexpected fgets() fail
";
}
fclose($handle);
}
This yields a warning:
Warning: mysqli::query() expects parameter 2 to be integer, string given in index.ph on line 14.
line 14:
if($update = $conn->query("UPDATE members SET isHere = 1 WHERE SmartRiderID = ?", $smartRider))
the second problem: Even if I manually type the smartRider that is in the database, nothing gets updated.
Any help would really be appreciated.