I am trying to update a database with a constant, Guest. I have an array containing dates, and have set a for loop to cycle through them, the query should amend one row whos date matches the array key AND the starttime of 19:00:00. However it is not amending the database. Where am i going wrong?
$size1 = sizeof($dayOfTheWeek) - 1;
for ($count = 0; $count <= $size1; $count++) {
$query = "UPDATE rota SET title=Guest WHERE date = '$dateMonthYearArr[$count]' AND starttime = '19:00:00'" or die;
$dayresult = mysql_query($query);
echo "".$dateMonthYearArr[$count]."</br>";
}
echo "Complete";
You should also make sure $dateMonthYearArr[$count] is SQL safe =).