Page 2 of 2

Posted: Wed Oct 20, 2004 9:52 am
by feyd
you need to use now() for both fields.

Posted: Wed Oct 20, 2004 9:59 am
by Diod
still only adds everything except date and time:

Code: Select all

$query = 'IN.SERT INTO news (text, author, email, date, time, title) VALUES(''' . $_POST['text'] .''', ''' . $_POST['author'] .''', ''' . $_POST['email'] . ''', '''. 'NOW()' . ''', '''. 'NOW()' . ''', ''' . $_POST['title'] . ''')';
  $result = mysql_query($query,$db);

Posted: Wed Oct 20, 2004 10:00 am
by mudkicker

Code: Select all

... 'I-N-SERT INTO ...
You have to write INSERT

Posted: Wed Oct 20, 2004 10:03 am
by Diod
its INSERT.. i had to do I-N-SERT because if i dont, i couldnt post the message

Posted: Wed Oct 20, 2004 10:30 am
by feyd
your asking mysql to enter the string NOW() not the return from NOW()... remove the '' stuff around them.

Posted: Wed Oct 20, 2004 12:35 pm
by Diod
thx

got it by doing

Code: Select all

$query = "INS ERT INTO news (text, author, email, date, time, title) VALUES('". $_POST['text'] ."', '". $_POST['author'] ."', '". $_POST['email'] ."',now(),now(),'".$_POST['title']."');";