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

Secure pages Sessions vs. Cookies & session_destroy() help
Im new here and new to PHP, I hope you can help me with some questions.

Im writing my web ap

Problem with passing variables
I'm not really a php programmer so I'm really struggling with this issue.

I have a banner s

Using two $_POST Function / Switch () statements, second does not work.
Hi all. I’m new to php and am having a problem getting $_POST Function / switch () to work. I

Writing Windows Device Drivers with C
Yes: one of the nice features of C is void*. You can put anything there and get anything out. Very

Header is not working in IE
Hi ! header function is not working in IE but it works in FF, Safari, Chrome. any help please. :

Undefined offset when using a flat file with pipe symbols
Hi, I've got a flat file/text file which I'm currently using as a member database for my site (not a

Update not working ... please help
Hi,

I am trying to update a row using an edit form by passing id of the row .. but it is not

mysql timestamp manipulation
How could I use a timestamp (e.g 2009-10-30 13:20:35 ), and with php find out if it is:

from

GET vs SUBMIT Button to show sections on one index.php page?
Just curious if one of these ways is better (i.e. more efficient) than the other.

I have a

PHP hyperlinks generator - HELP plz
Hi

I need some help to get this done using php:


1 - I have few hyperlinks say 500

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