Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2005
    Posts
    555
    Plugin Contributions
    4

    Default tep_db_fetch_array in while please help me understand it!

    Hi,
    As per...
    http://www.zen-cart.com/wiki/index.p...dules_from_osC

    I was wondering if someone could help me understand this as its the last query type I cant get to work well....
    Example...
    PHP Code:
    $orders_status_query $db->Execute("SELECT orders_status_id, orders_status_name FROM " TABLE_ORDERS_STATUS " WHERE language_id = '" . (int)$languages_id "'");
      while (
    $orders_status tep_db_fetch_array($orders_status_query)) {
        
    $orders_statuses[] = array('id' => $orders_status['orders_status_id'],
                                   
    'text' => $orders_status['orders_status_name']);
        
    $orders_status_array[$orders_status['orders_status_id']] = $orders_status['orders_status_name'];
      } 
    According to the wiki and others it should be something like this...

    PHP Code:
    $my_var $db->Execute("query stuff");
    while (!
    $my_var->EOF) {
    do_stuff;
    $my_var->MoveNext();

    but which my_var should it be in the above example?

    Ive tried...
    PHP Code:
    $orders_status_query $db->Execute("SELECT orders_status_id, orders_status_name FROM " TABLE_ORDERS_STATUS " WHERE language_id = '" . (int)$languages_id "'");
      while (!
    $orders_status->EOF) {
        
    $orders_statuses[] = array('id' => $orders_status['orders_status_id'],
                                   
    'text' => $orders_status['orders_status_name']);
        
    $orders_status_array[$orders_status['orders_status_id']] = $orders_status['orders_status_name'];
     
    $orders_status->MoveNext();
     } 
    And that gives a fatal error...
    Fatal error: Call to a member function on a non-object

    If I try...
    PHP Code:
    $orders_status_query $db->Execute("SELECT orders_status_id, orders_status_name FROM " TABLE_ORDERS_STATUS " WHERE language_id = '" . (int)$languages_id "'");
      while (!
    $orders_status->EOF) {
        
    $orders_statuses[] = array('id' => $orders_status['orders_status_id'],
                                   
    'text' => $orders_status['orders_status_name']);
        
    $orders_status_array[$orders_status['orders_status_id']] = $orders_status['orders_status_name'];
    $orders_status_query->MoveNext();
     } 
    The page hangs.

    Im confused, if anyone can help me out here to explain a little I would appreciate it!
    Thanks in advance.
    My humble contributions....
    Info at a Glance Admin, Alternative Header & Improved Whos Online + Currently working on the next!
    If you have to think..... your obviously looking at the admin :)

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

    Default Re: tep_db_fetch_array in while please help me understand it!

    You've got mismatched object names ... shown in red ...
    and you're missing the pointers to the fields ... shown in blue:

    Code:
    $orders_status_query = $db->Execute("SELECT orders_status_id, orders_status_name FROM " . TABLE_ORDERS_STATUS . " WHERE language_id = '" . (int)$languages_id . "'");
      while (!$orders_status->EOF) {
        $orders_statuses[] = array('id' => $orders_status->fields['orders_status_id'],
                                   'text' => $orders_status->fields['orders_status_name']);
        $orders_status_array[$orders_status->fields['orders_status_id']] = $orders_status->fields['orders_status_name'];
    $orders_status_query->MoveNext();
     }
    .

    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
    Mar 2005
    Posts
    555
    Plugin Contributions
    4

    Default Re: tep_db_fetch_array in while please help me understand it!

    Exceeeeeeeeeeeeeeellllllllllllllent Chris!
    Thank you very much for the pointers and congrats on the recent release.
    My humble contributions....
    Info at a Glance Admin, Alternative Header & Improved Whos Online + Currently working on the next!
    If you have to think..... your obviously looking at the admin :)

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

    Default Re: tep_db_fetch_array in while please help me understand it!

    Sorry,
    Im still not 100% on this, where it says my_var should this be the same throughout the query please?
    Thanks
    My humble contributions....
    Info at a Glance Admin, Alternative Header & Improved Whos Online + Currently working on the next!
    If you have to think..... your obviously looking at the admin :)

  5. #5
    Join Date
    Mar 2004
    Posts
    16,042
    Plugin Contributions
    5

    Default Re: tep_db_fetch_array in while please help me understand it!

    try this

    Code:
    $orders_status = $db->Execute("SELECT orders_status_id, orders_status_name FROM " . TABLE_ORDERS_STATUS . " WHERE language_id = '" . (int)$languages_id . "'");
      while (!$orders_status->EOF) {
        $orders_statuses[] = array('id' => $orders_status->fields['orders_status_id'],
                                   'text' => $orders_status->fields['orders_status_name']);
        $orders_status_array[$orders_status->fields['orders_status_id']] = $orders_status->fields['orders_status_name'];
    $orders_status->MoveNext();
     }
    Zen cart PCI compliant Hosting

  6. #6
    Join Date
    Mar 2005
    Posts
    555
    Plugin Contributions
    4

    Default Re: tep_db_fetch_array in while please help me understand it!

    Yes mate you do
    Ah sorry Merlin, just figured it out but thank you for your help!!!!!!!!!
    My humble contributions....
    Info at a Glance Admin, Alternative Header & Improved Whos Online + Currently working on the next!
    If you have to think..... your obviously looking at the admin :)

 

 

Similar Threads

  1. Replies: 11
    Last Post: 30 Sep 2011, 07:34 PM
  2. Please help me understand Stock Levels, Out of Stock, etc
    By ungarod in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 22 Feb 2008, 08:20 PM
  3. Help me understand ecommerce esp in UK
    By trond.rud in forum General Questions
    Replies: 15
    Last Post: 5 Mar 2007, 07:45 PM
  4. please help me better understand the template override system I've been making tons o
    By recordshow in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 16 Nov 2006, 01:04 PM
  5. Please help me understand the override system.
    By angelicdezigns in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 9 Jul 2006, 06:06 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