jeff5656 Posted November 21, 2008 Share Posted November 21, 2008 Here is part of my form. <input name="which_month" type="text" size="20" value="<?php echo $row['which_month']; ?>" /> But when I run the action script (see below) I get "Unknown column 'November' in 'where clause' (November is the posted variable in this example) include "../connectdb.php"; $this_month=$_POST['which_month']; $query = "UPDATE staffsched SET "; $set = array(); foreach($_POST as $field => $value){ $field = mysql_real_escape_string($field); $value = mysql_real_escape_string($value); $set[] = "`{$field}` = '{$value}'"; } $query .= implode(", ",$set) . "WHERE which_month = $this_month"; mysql_query($query) or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/133577-solved-cant-update-the-table/ Share on other sites More sharing options...
marcus Posted November 21, 2008 Share Posted November 21, 2008 We established this previously. $query .= implode(", ",$set) . " WHERE `which_month` = '".$this_month."'"; Link to comment https://forums.phpfreaks.com/topic/133577-solved-cant-update-the-table/#findComment-694814 Share on other sites More sharing options...
gevans Posted November 21, 2008 Share Posted November 21, 2008 $query .= implode(", ",$set)." WHERE which_month='$this_month'"; Link to comment https://forums.phpfreaks.com/topic/133577-solved-cant-update-the-table/#findComment-694820 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.