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

convert PHP array to Javascript array
I have a page that gets a request sent from AJAX, and I am trying to convert a PHP array to a javasc

need help in update query
i create a form for update. there are 8 columns in my mysql table. on my main page all the data is r

xApp Analytics in BI 7.0
Dear all,

I am trying to implement xApp Analytics in BI 7.0. After I installed the analyt

AJAX form submit
I recently built a form that submits data to my database with an ajax function that is called throug

search function
HI guys,

if anyone could point us in the right direction of how to do this, or provide some t

Facebook status update API
Hello,

So, I'm trying to create my first Facebook application with PHP.

Basic ideas fo

Problem with variable declaration in switch statement
Hello, I am having some trouble assigning a value to a variable inside a switch statement. What I a

mysql UPDATE request not working and driving me crazy!!!
Hi,

I have been stuck on this for ages.

Quite simply I am trying to update my database

WELCOME SCREEN
first of all let me tell you what does my script do,

it´s a very simple query to show a e

Is it a good practice to store user info. in sessions?
I am making a user class for my script which stores all the user information in sessions. It takes u

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