Inserting the current date/time while submitting the forum


Posted on 16th Feb 2014 07:03 pm by admin

What do I need to add below to update the current date/time? I have a field in the database called datetime. I tried to use Now() but its not working.

Code: <?php
$con = mysql_connect("host" , "aaaaa" , "pw");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("aaaaa", $con);

mysql_query("update application set comment='".mysql_real_escape_string($_POST[comment])."' where `name`='".mysql_real_escape_string($_POST[name])."'");

/*This is what I tried to add so that i can directly inject the current date/time*/
$sql="INSERT INTO application (datetime)
VALUES(NOW())";


mysql_close($con)
?>

No comments posted yet

Your Answer:

Login to answer
210 Like 37 Dislike
Previous forums Next forums
Other forums

Delete HTML file after loading
I have limited experience with php and its been a year or two since I've last used it. I have a sma

path to include folder
Hi everyone,

When I'm testing locally, I have to add the name of the site folder as part of t

Oracle Connectivity
Hi Every One,

Can we access SAP from oracle database.If it possible then please spec

recrawling
Can anyone suggest me how may i know a page is updated before it is being downloaded, so that i can

Escaped characters
I have a script that allows you to post news to the home page of my site. Along with the news is the

PHP5 - AJAX help
I've been following the tutorial on w2schools (http://www.w3schools.com/php/php_ajax_database.asp) a

a function to check directory depth
I'm working on a php script to upload files in to a set directory.
the user can select to upload

PHP Form to Variable.
Hi! I have written a HTML-form code in DreamWeaver CS3 (in a PHP doc) and I really need it to work s

Batch update record with Pagination
Hoping someone can help me with this issue I'm having, im trying to batch update records from a resu

PHP Game
hy i was wondering what's the best method in order to make some automatic updates in a php game
<

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash