Thread: mysql now()

Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Aug 2005
    Location
    Vic, Oz
    Posts
    1,905
    Plugin Contributions
    5

    Default mysql now()

    For a mod I am working on I want to get the result of the mysql now() function.
    I don't want the server or php version it has to be the mysql now() version.

    In other words can a mysql expert show me a simple way in a zen cart environment to write a simple and efficient "do nothing" query that returns the value of mysql now() to a variable. I know I can save it to database field and then read it but I am looking for a more efficient way.

    Cheers Gilby

  2. #2
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: mysql now()

    PHP Code:
    $sql "select now() as date from address_book limit 1";
    $result $db->Execute($sql);

    $database_server_date_timte $result->fields['date']; 
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Aug 2005
    Location
    Vic, Oz
    Posts
    1,905
    Plugin Contributions
    5

    Default Re: mysql now()

    Quote Originally Posted by DrByte
    PHP Code:
    $sql "select now() as date from address_book limit 1";
    $result $db->Execute($sql);

    $database_server_date_timte $result->fields['date']; 
    Thanks for the code Dr Byte. Simplified it slightly and the following works like a charm.

    PHP Code:
    $result $db->Execute("select now() as date"); 
    $database_server_date_time $result->fields['date']; 

 

 

Similar Threads

  1. Restored MySQL now can't access Admin
    By bluelightnin6 in forum General Questions
    Replies: 6
    Last Post: 12 Jan 2012, 02:14 AM
  2. Upgraded to MySQL 5.1 - now some sites can't login
    By ambition in forum General Questions
    Replies: 6
    Last Post: 11 Apr 2011, 07:24 AM
  3. MYSQL Upgrade, now getting errors on mods
    By netchaos in forum General Questions
    Replies: 2
    Last Post: 22 Feb 2009, 10:19 PM
  4. I now have too big a mysql file :(
    By ericgu in forum General Questions
    Replies: 4
    Last Post: 19 Nov 2006, 08:12 AM

Posting Permissions

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