Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2012
    Posts
    282
    Plugin Contributions
    0

    Default getting SQL errors with my observer class code,

    I'm creating a new observer class and having some problems with the following code.
    PHP Code:
    function update(&$class$eventID$paramsArray = array()) {
        global 
    $db;
        
    $ormDProducts = array();
        
    $q 'select products_id from products_addl_data where orm_d_class >= 1';
        
    $result $db->Execute(sql);
        while(!
    $result->EOF) {
            
    array_push($ormDProducts$result->fields['products_id']);
        } 
    etc. etc,….

    the error log states there is an error with SQL syntax. but when entering the only SQL used, which is:

    'select products_id from products_addl_data where orm_d_class >= 1';

    ..into my command line window, i do not get any errors but instead get a result.

    if instead i manually create the array and fill with product ids, like this
    $ormDProducts = array(242, 328);
    this class file works.
    anyone know why the above code is generating errors??

  2. #2
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: getting SQL errors with my observer class code,

    What EXACTLY is the error?

    And what did you mean by "etc etc"?

    Plus, you're missing the moveNext() call inside your while loop.
    .

    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. v155 Custom observer class stopped working after upgrade to v1.5.5a
    By d9000 in forum General Questions
    Replies: 7
    Last Post: 9 Jun 2016, 03:30 PM
  2. setting $_SESSION variables in an Observer Class
    By tcarden in forum Contribution-Writing Guidelines
    Replies: 1
    Last Post: 13 Feb 2013, 06:37 AM
  3. Getting SQL errors since upgrading
    By bogyi in forum General Questions
    Replies: 4
    Last Post: 1 Nov 2010, 09:32 AM
  4. session objects in the observer class
    By wdrwc in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 18 Jul 2006, 06:48 PM
  5. session objects in the observer class
    By wdrwc in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 18 Jul 2006, 11:19 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR