SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2010
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Running two stored procedures in php

    I have two stored procedures set up. I am trying to run one right after the other, but I keep getting this error message:

    An error occurred in script '/home/content/j/w/a/jwarrenn1/html/texas-overland-outfitters/deleteme2.php' on line 29:
    mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given

    I have tried to unset the first stored procedure and tried mysqli_free_result as well. They don't seem to work. I am at a stand still I can get this to work if I use this:

    <?php while ($row_rsImage2 = mysql_fetch_assoc($rsImage2)) { // Fetch each item.

    // Print the item within some HTML:
    echo '<li><a href="' . BASE_URL . 'browse/' . urlencode($row_rsImage2['category']) . '/' . $row_rsImage2['categoryId'] . '">' . $row_rsImage2['category'] . ' </a></li>';

    } ?>

    But not if I try the stored procedure. Please help.

    Here is the code:

    <ul>
    <?php
    $sCM = mysqli_query ($dbc, 'CALL selectCategories_menu()');
    if (mysqli_num_rows($sCM) > 0) {
    while ($row = mysqli_fetch_array($sCM, MYSQLI_ASSOC)) {
    echo '<li>' . $row['category'] . '</li>';
    }
    }
    ?>
    </ul>
    <h2>This is the second list</h2>
    <ul>
    <?php
    $r = mysqli_query ($dbc, 'CALL selectProducts_new()');
    if (mysqli_num_rows($r) > 0) {
    while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {
    echo '<li>' . $row['name'] . '</li>';
    }
    } else {
    echo '<li>Nothing to see here</li>';
    }

    ?>
    </ul>

  2. #2
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,068
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    The error message that your getting indicates that the query failed hence there are no affected rows. Use mysqli_error() to get the error returned by MySQL
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator


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
  •