Nov 22, 2009

Mysql Dates

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Programming > Programming General > SQL (Structured Query Language)

Mysql Dates

FirefoxRocks
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.

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

Somehow I keep getting this error:

QUOTE
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?

 

 

 


Comment/Reply (w/o sign-up)

FlashNet
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.




Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords :

  1. Constraints Don't Work In Mysql?
    (11)
  2. How To Increment A Mysql Field At Regular Intervals?
    (4)
    I need an operation that involves increasing the MySQL field value of all records by 1 every 15 or
    30 minutes. Since hundreds or thousands of records are present, there must be an automatic
    script/program that can do this. Think in terms of game sites which increase your army/gold every
    update. Basically I'm doing the same thing. How do I setup my database/table to do that?....
  3. MySQL For EasyPHP Users
    Does anyone use this program? (5)
    I installed a program called EasyPHP because it was an easy install and I wanted to be able to learn
    php and still be able to down the road learn MySQL. But I can't figure out how to use MySQL.
    Does anyone out there use this program that could tell me alittle about it. Alot of the product
    site is written in a different language, but everything on the program is english so that is good.
    Any help would be appreciated.....
  4. Random MySQL Entry
    (1)
    I am tring to figure this out and I can't. When you set a primary key. Say something_id and it
    is defined as a int (12) auto_inc. I go and fill it up with 10 entries, meaning it is now set to be
    something_id entry 10, but say I go and delete entry 5. Why doesn't it take that 5 for the next
    number, but instead it does a 11 and leaves 5 blank. How might I get it to where it fill's up
    the 5 instead of going to the next number or is that just one of the bad thing's of having a sql
    entry auto_inc ? Also, the random part. The reason I ask this is I take the....

    1. Looking for Mysql, Dates

See Also,

*SIMILAR VIDEOS*
Searching Video's for Mysql, Dates
advertisement



Mysql Dates

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com