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");
Did you know?Explore Trending and Topic pages for more stories like this.
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

Clean URLs
Hi I was wandering if anyone has ever implemented URLs on their PHP run website using URLS like wiki

Multidimensional Array into an Html table, help!
Hello all, I am new to HTML/PHP so any help would be great.

I have a multidimensional array f

Multithreading design
Hi

I have come up with a Singleton class that manages a pool of database connections. Basical

How to limit the calls to an API
Hello, in my simple script I call an api which effectively involves me getting an xml file.

H

Multi Level Array Problem
hi all,

For example I have array like below:

$temp = array(array('north america', 'us'

Request.UrlReferrer
I need to make it so that a page can only be loaded when a button is clicked on a specific page. I d

Displaying an image using echo command
I had done a query on my database, one of the fields being an image reference to a directory where a

How to extract/download content from HTTPS page?
Hello to all the Members of this forum, Im Shoiab, A novice programmer in php.. for my first job I h

ctype() validation - allowing illegal characters
Hello,
I use ctype() to filter and validate a user form. However, I am trying to allow certain c

Check before inserting in DB ???
This is my code
---------------
if ( $_POST ['Submit'])
{{
$username = $_POST ['usernm

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