Hi!
I am having a problem updating a date function in my db. Year, month, and day are all set using drop down menus. Each are saved to $year, $month, and $day columns in the table. These three are combined to fill a 'date' column.
When I originally set the date, the date column is correct. But when I go to alter the date, the new date does not update. I am positive I have over-complicated it, but as of now, I am either returning the original date or no date, depending on how I break it 😃
And I am sure it's flubbed up in the last part.
Does anyone see what I am doing wrong?
Code:
$date_string = $depyear . "-" . $depmonth . "-" . $depday;
$sqlquery = "INSERT INTO diw_alpha VALUES('','".$_POST['depmonth']."','".$_POST['depday']."','".$_POST['depyear']."',,'".$date_string."')";
And here go to change the date..
<TD>Month: <select name="newdepmonth">
<option value="'.$row['depmonth'].'">'.$row['depmonth'].'</option>
<option>01</option>
<option>02</option>
<option>03</option></select>
Day:
<select name="newdepday">
<option value="'.$row['depday'].'">'.$row['depday'].'</option>
<option>01</option>
<option>02</option>
<option>03</option></select>
Year:
<select name="newdepyear">
<option value="'.$row['depyear'].'">'.$row['depyear'].'</option>
<option>2005</option>
<option>2006</option></select>
</TD>
And here is where I tried to alter the date:
$newdate_string = $newdepyear . "-" . $newdepmonth . "-" . $newdepday;
$query = "UPDATE `diw_alpha` SET depmonth ='".$_REQUEST['newdepmonth']."', depday ='".$_REQUEST['newdepday']."', depyear ='".$_REQUEST['newdepyear']."',date_string = '".$_REQUEST['newdate_string']."' WHERE id='$id'";