71 users online (0 members and 71 guests)  


  Results 1 to 2 of 2

Related

  1. Is a page rank 3 worth $40 for getin returns??    Forum: Domain Name Sales
    Replies: 2
  2. Replies: 0
  3. Script Returns HTTP Error 405    Forum: CGI Perl Forum
    Replies: 4
  4. emailing forms excluding empty fields    Forum: HTML Forum
    Replies: 2
  5. Script inserts empty fields into DB    Forum: PHP Forum
    Replies: 2
  1. #1
    ramdattk's Avatar
    New User

    Status
    Offline
    Join Date
    Feb 2005
    Posts
    1

    Query REturns Empty

    Hi,
    I have a table named programming containing the following columns:
    DOW - Day of the week
    Program - Program
    Guest - Speaker name

    I have data in the above table however, whenever i execute the below script I don't get any results:
    SELECT * FROM `Programming` WHERE dow =( "SELECT DAYNAME(CURRENT_DATE)")


    Can anyone assist me with this problem?

    Cheers

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hi, welcome to the forums.

    I'm not sure on that syntax, so lets do this in two chunks.

    First, lets make sure you capture errors and display them. You can do that similar to the below example

    Code:
    if (!$result = mysql_query($sql)) {
    echo mysql_error();
    }
    First try that and see if that produces an error.

    Then try your select

    Code:
    SELECT * FROM `Programming` WHERE dow=DATE_FORMAT(CURRENT_DATE, "%w")
    Again, I'm unsure of that format because my more advanced SQL has always been done in SQL Server rather than mySQL, but this should also help

    http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html

    First lets get any errors tho.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread