By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,953 Members | 1,143 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,953 IT Pros & Developers. It's quick & easy.

How to use multiple stored procedures on single page in php

P: 6
Hi all,i need help on an application i am writing where i am populating different "select" boxes based on input from a stored procedure "calling" a MYSQL database. The issue is that once i have called a stored procedure,any subsequent call to a different procedure will lead to the page not rendering.
Here is the page:
Expand|Select|Wrap|Line Numbers
  1. <td><select name="leaseType" id="leaseType" >
  2.           <option value=""> Select Lease Type </option>
  3.  
  4.  
  5.  
  6.           <?php
  7.  
  8. include 'easy_connect.php';
  9. $sql="call getLeaseType()";
  10. $result=mysqli_query($link,$sql) or die ("Error in processing query.".mysqli_error($link));
  11.  
  12. while ($row=mysqli_fetch_assoc($result))
  13.     {$id=$row['LeaseTypeID'];
  14. $name=$row['Lease'];
  15. echo "<option value=$id>$name\n";
  16. mysqli_close($link);
  17.     }
  18.             ?>
  19. </select>
  20. </td>
  21.       </tr>
  22.  <td>Price Range:</td>
  23.         <td><select name="price" id="price" onchange="change(this.form)">
  24.           <option value=""> Select Price </option>
  25.           <?php
  26.  
  27. $sql="call getLeaseType()";
  28. $result=mysqli_query($link,$sql) or die ("Error in processing query.".mysqli_error($link));
  29.  
  30. while ($row=mysqli_fetch_assoc($result))
  31.     {$id=$row['LeaseTypeID'];
  32. $name=$row['Lease'];
  33. echo "<option value=$id>$name\n";
  34.     }
  35.  
  36.      ?>
  37.         </select>
  38.           </td>
  39.       </tr>
  40.  
When i do the above...the first works drop-down populates..but the second does not even populate...and the page cuts off halfway.Will really appreciate help..THANKS....
Sep 26 '11 #1
Share this Question
Share on Google+
1 Reply


Dormilich
Expert Mod 5K+
P: 8,639
you shouldn’t close the DB connection prematurely (line #16).
Sep 27 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.