Results 1 to 7 of 7

Thread: mysql select on date field working in phpmyadmin but not vbscript

  1. #1
    Senior Member
    Join Date
    Sep 2007
    Posts
    409
    Thanks
    7
    Thanked
    32 times in 12 posts
    • icanhazburger's system
      • Motherboard:
      • Foxconn 946GZ7MA/946PL7MA Series
      • CPU:
      • DualCore Intel Core 2 Duo E6400
      • Memory:
      • 2 gig DDR2-667
      • Storage:
      • 320gig Baracuda II
      • Graphics card(s):
      • 7900 GS vc3600 cooler
      • PSU:
      • 600w
      • Case:
      • Something with a 25cm fan
      • Monitor(s):
      • 1 x 22"w 1 x 19"
      • Internet:
      • Pipex Max :(

    mysql select on date field working in phpmyadmin but not vbscript

    Hi, I'm running a query in vbscript that is returning no rows, yet in phpmyadmin it works fine, anyone got any ideas?

    Code:
    SELECT * FROM `jos_comprofiler` WHERE (((jos_comprofiler.cb_donotemail <> 1 AND jos_comprofiler.cb_donotsms <> 1) OR (jos_comprofiler.cb_donotemail IS NULL AND jos_comprofiler.cb_donotsms IS NULL)) ) AND (`cb_membershipexpires` < STR_TO_DATE('31/12/2020', '%d/%m/%Y'))
    In the internets, no one can hear you sarcasm.

  2. #2
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,164
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts

    Re: mysql select on date field working in phpmyadmin but not vbscript

    top tip.

    Never, EVER, EVER do SQL using a date as dd/mm or mm/dd.

    because how do you know which is which?

    I know MySQL is a veritable bastion of bad practice but still!

    Use MMM to get a nice short date like Apr.
    throw new ArgumentException (String, String, Exception)

  3. #3
    Senior Member
    Join Date
    Sep 2007
    Posts
    409
    Thanks
    7
    Thanked
    32 times in 12 posts
    • icanhazburger's system
      • Motherboard:
      • Foxconn 946GZ7MA/946PL7MA Series
      • CPU:
      • DualCore Intel Core 2 Duo E6400
      • Memory:
      • 2 gig DDR2-667
      • Storage:
      • 320gig Baracuda II
      • Graphics card(s):
      • 7900 GS vc3600 cooler
      • PSU:
      • 600w
      • Case:
      • Something with a 25cm fan
      • Monitor(s):
      • 1 x 22"w 1 x 19"
      • Internet:
      • Pipex Max :(

    Re: mysql select on date field working in phpmyadmin but not vbscript

    I'm afraid I've been dumped with a half completed site that another company had not finished for someone, the field type is date.

    I'm not sure what you mean by 'Use MMM to get a nice short date like Apr'.
    In the internets, no one can hear you sarcasm.

  4. #4
    Funking Prink! Raz316's Avatar
    Join Date
    Jul 2003
    Location
    Deal, Kent, UK
    Posts
    2,978
    Thanks
    130
    Thanked
    62 times in 52 posts

    Re: mysql select on date field working in phpmyadmin but not vbscript

    Never used vbscript, but is it fussy about certain characters? If you were to echo/display the SQL in question, does it display ok?

  5. Received thanks from:

    icanhazburger (10-06-2008)

  6. #5
    Senior Member
    Join Date
    Sep 2007
    Posts
    409
    Thanks
    7
    Thanked
    32 times in 12 posts
    • icanhazburger's system
      • Motherboard:
      • Foxconn 946GZ7MA/946PL7MA Series
      • CPU:
      • DualCore Intel Core 2 Duo E6400
      • Memory:
      • 2 gig DDR2-667
      • Storage:
      • 320gig Baracuda II
      • Graphics card(s):
      • 7900 GS vc3600 cooler
      • PSU:
      • 600w
      • Case:
      • Something with a 25cm fan
      • Monitor(s):
      • 1 x 22"w 1 x 19"
      • Internet:
      • Pipex Max :(

    Re: mysql select on date field working in phpmyadmin but not vbscript

    Quote Originally Posted by Raz316 View Post
    Never used vbscript, but is it fussy about certain characters? If you were to echo/display the SQL in question, does it display ok?
    Good call, when I'm passing the query between two asp pages its removing the % characters from '%d/%m/%Y' so its 'd/m/Y'
    In the internets, no one can hear you sarcasm.

  7. #6
    Funking Prink! Raz316's Avatar
    Join Date
    Jul 2003
    Location
    Deal, Kent, UK
    Posts
    2,978
    Thanks
    130
    Thanked
    62 times in 52 posts

    Re: mysql select on date field working in phpmyadmin but not vbscript

    nice one, sorted! : )

  8. #7
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts

    Re: mysql select on date field working in phpmyadmin but not vbscript

    Single quote is vbscript comment char, can't see if that's applicable with snippet provided however.
    To err is human. To really foul things up ... you need a computer.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 06-04-2008, 05:00 PM
  2. Mysql complex ordering
    By Raz316 in forum Software
    Replies: 6
    Last Post: 04-03-2008, 08:28 AM
  3. MySQL extension for PHP 5.2.3 not working
    By Jerrythafast in forum Help! Quick Relief From Tech Headaches
    Replies: 18
    Last Post: 13-06-2007, 08:03 PM
  4. MYSQL Default Date
    By Vini in forum Software
    Replies: 7
    Last Post: 02-11-2006, 01:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •