Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: PHP and MySQL 24-Hour Trainer
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: PHP and MySQL 24-Hour Trainer
This is the forum to discuss the Wrox book PHP and MySQL 24-Hour Trainer by Andrea Tarr ; ISBN: 978-1-1180-6688-1
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: PHP and MySQL 24-Hour Trainer section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 10th, 2012, 03:39 PM
Registered User
Points: 10, Level: 1
Points: 10, Level: 1 Points: 10, Level: 1 Points: 10, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Commands out of sync; you can't run this command now on $result_obj->fetch_object

I am trying to use stored procedure to execute the article query and I've googled from stackoverflow to php.net manual it seems I can not get to free_result the returned data set. Please note on a regular SQL statement this works fine but I need stored procedure for my project. Thank you

Code:
  public static function getArticles() {
    // clear the results
    $items = '';
    // Get the connection  
    $connection = Database::getConnection();
    // Set up query this works ok
    $query = 'SELECT * FROM `articles` ORDER BY title';
    // this one doesn't
    $query = "CALL sp_INSUPDEL_tbl_articles (0,'','',0,0,'',0,0,'title')";

    $result_obj = '';
    $result_obj = $connection->query($query);

    try {  
      /*
      the Commands out of sync; you can't run this command now happens this so If I have 20 results then 20 commands out of sync message is displayed. which is kinda annoying on client side :))
     */
      while($result = $result_obj->fetch_object('Article')) {
        $items[]= $result;
      }
      return($items);
    }
  ............

     /*
        I even tried this but it does nothing
     */

    try {  
       /* store first result set */
       if ($result = $result_obj->store_result()) 
         {

      while($result = $result_obj->fetch_object('Article'))
          {
        $items[]= $result;
           }

        $result->free();
        }
      // pass back the results
      return($items);
    }
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help-Implementing a unix shell to run commands ssimkhan Java Basics 1 June 15th, 2007 06:43 AM
Help-Implementing a unix shell to run commands ssimkhan Pro Java 0 June 7th, 2007 04:58 AM
Sending a string of commands to the command prompt Wire323 Access VBA 4 December 14th, 2006 06:14 AM
How to run DOS file commands using vba? alastair Access VBA 2 August 12th, 2006 03:40 AM



All times are GMT -4. The time now is 12:50 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.