|
-
May 10th, 2002, 11:16 AM
#1
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") ')";
-
May 10th, 2002, 12:52 PM
#2
Stuck in the 80s
Shouldn't it be:
PHP Code:
$query = "INSERT INTO Guests (UserName, Email, Comments, date)) Values('$UserName', '$Email', '$Comments', 'date(\"Y-m-d\")')";
-
May 10th, 2002, 01:06 PM
#3
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")."')";
-
May 10th, 2002, 02:41 PM
#4
PowerPoster
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?
-
May 10th, 2002, 02:51 PM
#5
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?
-
May 10th, 2002, 02:55 PM
#6
PowerPoster
Not to me 
Thanks for trying and at least it works. I'll figure it out eventually.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|