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

Link to comment
Share on other sites

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+)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.