-
hehe you can't do it that way.
$query = "INSERT INTO Guests (UserName, Email, Comments, date("Ymd")) Values('$UserName', '$Email', '$Comments', '$Date')";
date("Y-m-d") is a value not the name of the field. so do it like this
$query = "INSERT INTO Guests (UserName, Email, Comments, date)) Values('$UserName', '$Email', '$Comments', 'date("Y-m-d") ')";
-
Shouldn't it be:
PHP Code:
$query = "INSERT INTO Guests (UserName, Email, Comments, date)) Values('$UserName', '$Email', '$Comments', 'date(\"Y-m-d\")')";
-
very possible. if it doesn't work the way I have it you can try hobos way. or you can try this
$query = "INSERT INTO Guests (UserName, Email, Comments, date)) Values('$UserName', '$Email', '$Comments', '".date("Y-m-d")."')";
-
OK, some of them worked kind of and some didn't work at all. The ones that worked kind of would add the record, but the date would be 0000-00-00.
This is the one that worked from sscout sans a stray parenthesis.
$query = "INSERT INTO Guests(UserName, Email, Comments, Date) Values('$UserName', '$Email', '$Comments', '".date("Y-m-d")."')";
What are the "dots" doing? Why does this work?
-
well it is hard to say. but the . makes it so it leaves the anotation of the select statement and lets you use " in the code. kind of like adding it to itself.
echo "todayts date = ". date("y-m-d") ;
does pretty much the samething. does tha tmake sense?
-
Not to me :(
Thanks for trying and at least it works. I'll figure it out eventually.