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

Echo-ing MySQL content and Keep Formatting?
I have data in my MySQL such as:

QuoteBlah blah

Blah blah

etc
but when i ech

Does deleting the spmlog directory critical?
Hi Everyone,

Please, hope you could help me. We're having problems with the SAP backup. I

Need Help with a query
Hello,
For some reason I am just not getting the right answer when I do this query and not quite

please help
HTML Code:

Code: <span id="ctl00"><span>

Login Issue's
Code: <?php
$file = fopen('user.txt', 'r');

/* Set login to false initially */

UTL File problem
Hi
I have a file in certain path with the following permissions (The file is a dummy file witho

Reading waves
Hi,

I am trying to find a way of finding the highs and lows on a graph line, the line points

C problem struct and string
Hi guys,

This is my first post and I'm hoping the experts here can help me solve my problem.<

a dificult string search
Hi I don't know a way around this. I want the user to input a password, but to make it a bit complca

Comparing MySql data and arrays.
I have a mysql table set up like this:
idsubjectbodyuseriddatetimetags1blog subjectblog body111|2

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