Jump to content
xisto Community
Sign in to follow this  

Mysql Dates

Recommended Posts

I'm trying to select records that have an ending event date/time after the current date/time. I have tried using a PHP variable $now=date("Y-m-d H:i:s");, CURDATE() as well as UNIX_TIMESTAMP in combination with strtotime("now");, but so far nothing is working.

SELECT * FROM `events` ORDER BY `eventStart` WHERE `eventEnd`>$now

Somehow I keep getting this error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/portal/public_html/sandbox/<blocked>/calendar/calendar.php on line 63

The eventEnd field is a MySQL datetime field: "YYYY-MM-DD HH:mm:ss"
How do I do this?
Edited by FirefoxRocks (see edit history)

Share this post

Link to post
Share on other sites

What code are you using for parce response from db?

I suppose that mysql returns number of rows ( > 1). So you can't use such result with mysql_fetch_array() . In this case you have to use mysqli_multi_query. Examples ca be found here.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.