Hi there. I'm totally new (about a week!) with php and mysql and am encountering a problem that perhaps someone can help me with?
I've looked through to see if a similar problem has appeared or been solved, but without success, so apologies if I am repeating something.
In php I am trying to update 7 fields from a form from which a user has edited/modified any of the fields in a chosen record (except id).
Here is the code:
$id=$_GET['id'];
$task=$_POST['task'];
$category=$_POST['category'];
$created=$_POST['created'];
$state=$_POST['state'];
$due=$_POST['due'];
$repeat=$_POST['repeat'];
$completed=$_POST['completed'];
mysql_select_db($database) or die( "Unable to select database for updating");
mysql_query("UPDATE tasks SET Task='$task',Category='$category', Status='$state', Created='$created', Due='$due',Completed='$completed', Repeat='$repeat' WHERE id = '$id'");
mysql_close();
No updating of any field occurs, so after playing around a bit I found that if I removed the Repeat section everything (except repeat of course) was updated successfully :
mysql_query("UPDATE tasks SET Task='$task',Category='$category', Status='$state', Created='$created', Due='$due',Completed='$completed' WHERE id = '$id'");
I also added:
echo "$repeat";
at the end and that shows that the variable $repeat does contain the new value from the form.
Adding another update query:
mysql_query("UPDATE tasks SET Repeat='$repeat' WHERE id = '$id'");
resulted in the repeat field not being updated.
Any thoughts?