Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Rower_CPU said:
Edit: Nevermind, then. :p

Sorry :(

I'm only having one little trouble, the code all works apart from this:

$upload_sql = "INSERT into essays (essay, datesubmitted, deadline, student_id) values ('".$data."', ".date("Y-m-d").", ".$_POST['type'].", ".$student_id.")";

In the DB once the essay is uploaded the date is 0000-00-00.

Hmm...
 
Personally, I'd put the date function into a variable and then put it into the insert, like so:
PHP:
$insertdate = date("Y-m-d");
$upload_sql = "INSERT into essays (essay, datesubmitted, deadline, student_id) values ('$data', '$insertdate', '$_POST[type]', '$student_id')";

PS. Try not concatenating - it makes things much simpler to read.
 
Works, thanks! :)

I'll start looking at the comments side again, but it looks like it should be easier.
 
Wes said:
Sorry :(

I'm only having one little trouble, the code all works apart from this:

$upload_sql = "INSERT into essays (essay, datesubmitted, deadline, student_id) values ('".$data."', ".date("Y-m-d").", ".$_POST['type'].", ".$student_id.")";

In the DB once the essay is uploaded the date is 0000-00-00.

Hmm...

If you are just inserting the date of the script execution you can use mysql inbuilt date function like this:

$upload_sql = "INSERT into essays (essay, datesubmitted, deadline, student_id) values ('".$data."', now(), ".$_POST['type'].", ".$student_id.")";

Edit: This only works if you declare the datatype for that column as date or datetime. mysql also has a range of date functions for you to choose from. Well, there pros and cons.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.