PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use [b][size=150][color=#FF0000]near[/color][/size][/b] 'WHERE N_ID = '3'' at line 1
EverLearning wrote:Sorry if I came off as arrogant in my postings, but you learn much more, if you find stuff out by yourself
Its fine with me. I guess you always learn something new if you try.
I am using mysql, and when i insert date in mysql through text boxes they get stored as yyyy-mm-dd, but when i update the records the date fields in mysql become 0000-00-00 and are displayed on pages as 0000-00-00. The table im mysql is
CREATE TABLE notes (
N_ID int(3) NOT NULL auto_increment,
username varchar(16) NOT NULL,
n_date date NOT NULL,
n_notes text NOT NULL,
PRIMARY KEY (N_ID)
);
UPDATE notes SET n_date = '', n_notes = 'q' WHERE N_ID = '3'
Thats why you date gets set to '0000-00-00'. $_POST['n_date'] was empty.
Also I don't think that your users are going to enter information in YYYY-mm-dd format. So you have to parse the date and enter the correct value. Something along these lines
//lets say that your dates are entered as mm/dd/YYYY
list($day, $month, $year) = explode(''/", $_POST['n_date']);
$date = "{$year}-{$month}-{$day}"; // the variable you should use in you update statement.