Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Whats wrong with this query? Fresh eyes needed ;)

    Note: this line ...
    PHP Code:
    return $points['customers_shopping_points']; 
    Might result in a better answer if you use:
    PHP Code:
    return $points->fields['customers_shopping_points']; 
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  2. #2
    Join Date
    Mar 2005
    Posts
    561
    Plugin Contributions
    4

    Default Re: Whats wrong with this query? Fresh eyes needed ;)

    Thanks to Ajeh for the pointer...
    In the end my cola power cotton wool fueled head decided to check how another file does this and finally came up with the following ...


    PHP Code:
        if (zen_not_null(POINTS_AUTO_EXPIRES)){
        global 
    $db;
          
    $points_query "SELECT customers_shopping_points FROM " TABLE_CUSTOMERS " WHERE customers_id = '" . (int)$id "' AND customers_points_expires > CURDATE() LIMIT 1";
        } else {
          
    $points_query "SELECT customers_shopping_points FROM " TABLE_CUSTOMERS " WHERE customers_id = '" . (int)$id "' LIMIT 1";
        }
        
    $points $db->Execute("$points_query");

        return 
    $points->fields['customers_shopping_points'];
      } 

  3. #3
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Whats wrong with this query? Fresh eyes needed ;)

    NOTE: if this is in a function ...

    The standard way to do this is to have:

    PHP Code:
    function my_function_name() {
      global 
    $whoever$whoever2$whoever_etc;
    // code stuff here

    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  4. #4
    Join Date
    Mar 2005
    Posts
    561
    Plugin Contributions
    4

    Default Re: Whats wrong with this query? Fresh eyes needed ;)

    Thank you Linda!

 

 

Similar Threads

  1. whats wrong with this css for my dropdown menu?
    By 1kell in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 28 May 2010, 02:47 AM
  2. Guess whats wrong with this code.... (footer links)
    By customk1 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 30 Mar 2009, 01:40 AM
  3. What's wrong with this query ?
    By emmdee in forum Basic Configuration
    Replies: 5
    Last Post: 10 Jul 2006, 06:21 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