Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Date Stamp MySql-PHP

New Here ,
Mar 29, 2008 Mar 29, 2008
Hi All:

I have a form that I using to upload my portfolio using the php insert record function of Dreamweaver. How can I make it add the date stamp using dreamweaver? Is the a piece of code some can provide? My thought was add some kinda of hidden field and do something with that. Any help would be appreciated.
TOPICS
Server side applications
423
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 29, 2008 Mar 29, 2008
.oO(cupaball)

> I have a form that I using to upload my portfolio using the php insert record
>function of Dreamweaver. How can I make it add the date stamp using
>dreamweaver? Is the a piece of code some can provide? My thought was add some
>kinda of hidden field and do something with that. Any help would be appreciated.

No need for a hidden field. You can directly insert the current date in
your SQL query with the NOW() function. The final query should then look
like this:

INSERT INTO yourTable (dateField, ...)
VALUES (NOW(), ...)

Micha
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 29, 2008 Mar 29, 2008
Great! Where does that go in all this Dreamweaver code?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 29, 2008 Mar 29, 2008
.oO(cupaball)

>Great! Where does that go in all this Dreamweaver code?
>
> if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "portfolio")) {
> $insertSQL = sprintf("INSERT INTO port_tb (comp_name, design_type, URL,
>short_des, long_des, thumbnail, medium_pic, large_pic, long_pic) VALUES (%s,
>%s, %s, %s, %s, %s, %s, %s, %s)",
> GetSQLValueString($_POST['comp_name'], "text"),
> GetSQLValueString($_POST['design_type'], "text"),
> GetSQLValueString($_POST['URL'], "text"),
> GetSQLValueString($_POST['short_des'], "text"),
> GetSQLValueString($_POST['long_des'], "text"),
> GetSQLValueString($_POST['thumbnail'], "text"),
> GetSQLValueString($_POST['medium_pic'], "text"),
> GetSQLValueString($_POST['large_pic'], "text"),
> GetSQLValueString($_POST['long_pic'], "text"));

Where do you want the date to go? The date column has to be listed
inside of the parentheses after "INSERT INTO port_tb", the NOW() call
inside the VALUES parentheses at the same position. Here's an example
with the date at the first position (adjust the name as necessary):

$insertSQL = sprintf("INSERT INTO port_tb (dateField, comp_name,
design_type, URL, short_des, long_des, thumbnail, medium_pic,
large_pic, long_pic) VALUES (NOW(), %s, %s, %s, %s, %s, %s, %s, %s,
%s)",
... // all the rest

Micha
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 29, 2008 Mar 29, 2008
Thanks you very much, I tried that earlier and it did not work. The reason why?, because I had the wrong filed name there, lol! Thanks again.

My next set of questions will be about sending an e-mail after an insert using dreamweaver and php...care to steer me it the right direction?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 31, 2008 Mar 31, 2008
LATEST
.oO(cupaball)

> My next set of questions will be about sending an e-mail after an insert using
>dreamweaver and php...care to steer me it the right direction?

What exactly is the problem or what have you tried so far?

Since it's a completely different question and has nothing to do with
this thread's subject anymore, it's usually a good idea to open a new
thread.

Micha
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines