Thread: Query builder

Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    463
    Plugin Contributions
    0

    Default Query builder

    Why doesn't query builder accept my constant (CAMPAIGN_LIMIT), when table name (TABLE_CUSTOMERS) is accepted?
    Code:
    SELECT customers_email_address, customers_firstname, customers_lastname 
    FROM TABLE_CUSTOMERS 
    WHERE customers_campaign >= CAMPAIGN_LIMIT 
    ORDER BY customers_lastname, customers_firstname, customers_email_address

  2. #2
    Join Date
    Jan 2012
    Posts
    488
    Plugin Contributions
    0

    Default Re: Query builder

    Quote Originally Posted by kalastaja View Post
    Why doesn't query builder accept my constant (CAMPAIGN_LIMIT), when table name (TABLE_CUSTOMERS) is accepted?
    Code:
    SELECT customers_email_address, customers_firstname, customers_lastname 
    FROM TABLE_CUSTOMERS 
    WHERE customers_campaign >= CAMPAIGN_LIMIT 
    ORDER BY customers_lastname, customers_firstname, customers_email_address


    Not sure where customers_campaign came from? but use lower case and check your table name (customers vs TABLE_CUSTOMERS)

    Code:
    SELECT customers_email_address, customers_firstname, customers_lastname 
    FROM customers 
    WHERE customers_campaign >= campaign_limit 
    ORDER BY customers_lastname, customers_firstname, customers_email_address

  3. #3
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    463
    Plugin Contributions
    0

    Default Re: Query builder

    Sorry, I don't get it! The TABLE_CUSTOMERS is defined (in upper case), why should I use lower case? I have added the "customers_campaign" for my own purposes and the whole thing works if I substitute 1000 for the CAMPAIGN_LIMIT! This issue would seem to require deep knowledge of the query builder...
    Last edited by kalastaja; 21 Oct 2012 at 07:30 AM.

  4. #4
    Join Date
    Jan 2012
    Posts
    488
    Plugin Contributions
    0

    Default Re: Query builder

    I thought you were using the default zen cart customer table which is customers, not TABLE_CUSTOMERS.

    If these are custom designed tables and fields, you will need to describe them.


    DESCRIBE TABLE_CUSTOMERS;


    Is campaign_limit an INT, VARCHAR, etc?

    try quoting your 'campaign_limit'

  5. #5
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    463
    Plugin Contributions
    0

    Default Re: Query builder

    Everything eccept "customers_campaign >= CAMPAIGN_LIMIT" is STARDARD query builder! "TABLE_CUSTOMERS" IS customers in query builder! CAMPAIGN_LIMIT (not campaign_limit) is
    Code:
    define ('CAMPAIGN_LIMIT', '1000');
    just as
    Code:
    define('TABLE_CUSTOMERS', DB_PREFIX . 'customers');
    We are talking MySQL as far as I can understand! This issue would seem to require deep knowledge of the query builder...
    TABLE... might be treated differently in query builder - that's what I need to know!
    Quoting didn't do the trick.
    Last edited by kalastaja; 21 Oct 2012 at 08:12 AM.

  6. #6
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Query builder

    The only constants accepted by query_builder are tablenames.
    .

    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.

 

 

Similar Threads

  1. v154 Help with a SQL Query for Query Builder
    By lindasdd in forum Managing Customers and Orders
    Replies: 2
    Last Post: 24 Mar 2016, 01:18 PM
  2. v151 SQL query setup. How do I TEST a query 'off-line'?
    By lewisasding in forum General Questions
    Replies: 3
    Last Post: 8 Mar 2013, 12:24 AM
  3. Name Builder...errr... PC Builder?
    By prosam in forum General Questions
    Replies: 3
    Last Post: 1 Oct 2010, 12:23 AM
  4. Query Builder Table syntax? - custom email groups
    By mcarbone in forum General Questions
    Replies: 4
    Last Post: 22 Apr 2010, 10:57 PM
  5. Query Builder Hanging
    By thomasharding in forum Managing Customers and Orders
    Replies: 6
    Last Post: 6 Oct 2009, 09:25 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