0

I have made two Procedures in PHPMyAdmin and are working absolutely correct on clicking the EXECUTE option. However when I run this PHP code the first procedure gives the result but the second does not.

 <?php
include "mysql_connect.php";

$query=mysql_query("CALL most_complaints_against();");
$mla_most=mysql_result($query,0,0);

$query=mysql_query("CALL least_complaints_against();");
$mla_least=mysql_result($query,0,0);
print "$mla_most....$mla_least";
?>

OUTPUT:

Warning: mysql_result() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\sample.php on line 8

[value of $mla_most]....

Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43
  • The file mysql_connect.php ensures database connectivity. – shubhank srivastava Nov 08 '13 at 13:17
  • I think you need to check for an error before calling mysql_result on the response. http://stackoverflow.com/questions/16668560/mysql-result-expects-parameter-1-to-be-resource-boolean-given the boolean is a failure indicator. – Michael - sqlbot Nov 08 '13 at 13:25
  • 2
    Please note that the `mysql_xx()` functions are deprecated. Using modern DB features like SPs with an obsolete API is always likely to give you problems. You should switch to using the `mysqli` or `PDO` libraries, which are specifically designed with SPs in mind. – Spudley Nov 08 '13 at 13:34
  • possible duplicate of [mysql\_fetch\_array() expects parameter 1 to be resource, boolean given in select](http://stackoverflow.com/questions/2973202/mysql-fetch-array-expects-parameter-1-to-be-resource-boolean-given-in-select) – John Conde Nov 09 '13 at 02:14

0 Answers0