Jump to content

Dreamweaver SELECT function with date variables


Recommended Posts

I have a PHP/MySQL site that I am designing in Dreamweaver. This probelm sort of covers php and MySql and Dreamweaver.

I have been putting information into a MySQL database with the standard INSERT script built into dreamweaver. Hoever, one field is auto generated with the TIME() function and is a hidden text feild. This is being inserted find, but when I try to build a MySQL SELECT statement in Dreamweaver (or by hand even!) I cannot work out how to call all records that have been entered in a certain date. (I understand the time() includes not only date but also time information. efforts so far have resulted in no data being listed in a dynamic table and the time has obviously changed between entering the info and the SLECT function running...therefore I just get a blank list)....can Anyone help as I am realy pulling my hair out and my manager wants me to prodcue a page that will display all quotes from the database that have been done on a certain day.

 

Many thanks for those php/MySQL/Dreamweaver experts out there who can help

The TIME data-type doesn't include date-information. Use DATETIME, if you want both. Here are MySQL's date and time related function. To insert the current date, time or datetime use NOW(). And you would select today's quotes like so:

 

[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] * FROM quotes WHERE DATE(quoteAdded) = CURDATE(); [!--sql2--][/div][!--sql3--]

 

(Note: Works with MySQL 4.1+)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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.