Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: PHP and MySQL 24-Hour Trainer
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 10th, 2012, 03:39 PM
Registered User
 
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);
    }





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.