Im currently designing/coding a small database for a small collection of dvd and divx that I have. A previous db ended up not working well because I had a 'date' field with an attribute of 'text' and when I tried to sort by date it wouldnt work. Im wondering how date should be used, when I set date it always gives a default value of 0000-00-00 which is not what I want. With the code I want to use, $today = (date("M-d-y"));, which contains partly alphabetical characters is it possible to use the attribute date or is there some sort of restriction on this field?
<?
$today = (date("M-d-y"));
$db = mysql_connect('localhost','ping','mouseman');
mysql_select_db("db", $db);
$sql = "INSERT INTO divx (name, comments, cds, user, date) VALUES ('$name','$comments','$cds','$user','date')";
$result = mysql_query($sql,$db);
if ($submitted) {
echo "Divx = $name <BR>";
echo "comments = $comments <BR>";
echo "cds = $cds <BR>";
echo "user = $user <BR>";
echo "date = $date <BR>";
echo "Submission Successful";
}
?>
Can someone give me a bit of insisght into this and possible tell me some correct code other than, $today = (date("M-d-y"));, which would work good.
Thanks in advance for your help,
Stewart