Change snippet to use CURDATE


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

I am using time() in the snippet below, I would like to use CURDATE() and have the database setup for date. My problem is, I am not sure how to change the PHP coding, I keep getting errors just adding CURDATE() where time() is. Any help would be greatly appreciated...


$update = mysql_query("UPDATE comments SET comment='".$comment."',created_at='".time()."' WHERE user_id=".$_SESSION['logged_id']);

} else {

$insert = mysql_query("INSERT INTO comments(`id`,`user_id`,`comment`,`created_at`) VALUES(0,".$_SESSION['logged_id'].",'".$comment."','".time()."')");

No comments posted yet

Your Answer:

Login to answer
155 Like 19 Dislike
Previous forums Next forums
Other forums

reading xml faster than DB call?
I am trying to optimize a high traffic website, and I enabled a feature where there are three photos

problem with refreshing
in my site, i have an index page, it has a main div. this main div's content is changing according t

validating url
im trying to validate url's sent to me by a form
the url's im collecting are for placing banners

Access website from only 1 computer...?
One of my customers wants his website to only be accessed by people in which they bought the website

Simple MySQL script is not working
Hey guys,

Just familiarizing myself with PHP and MySQL. I am following along in the O'Reilly

Form help: Syntax & Logic
Hello again all,

I'm working on a form and ran into a wall (again) and can't seem to think th

how to get IP address?
hey guys,

i have this code which is supposed to get me the IP address of my site visitors:

Beginner question regarding Array's
Hi everyone, the page im working on has an array of variable at the top...

Code: $define_li

PHP5 - Verifying a secure mail is secure
I need to send an e-mail from a form to a external department and because it contains personal custo

noob question
i traying to do a php form with auto replay for both(me and the user who send me a mail),

a 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