-1

This is my sql function

CREATE FUNCTION returnPrice(price int,member int)
RETURNS INT
BEGIN
RETURN(price*member);
END;

And this is my php code

$res1= "CALL returnPrice('$cost','$team_member')";
$rs1 = mysqli_query($con,$res1);
$row1= mysqli_fetch_array($rs1);

And then i got error like

'Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in' in $row1... line

I don't know what is wrong. pls help

Ravinder Reddy
  • 23,692
  • 6
  • 52
  • 82
  • 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) – Sahil Mittal Apr 21 '14 at 16:38

1 Answers1

0

Acording to mysqli.query

Returns FALSE on failure.

To check the reason of the failure you might try the following

$res1= "CALL returnPrice('$cost','$team_member')";
$rs1 = mysqli_query($con,$res1);
if ($rs1 === false) {
   printf("Error: %s\n", $mysqli->error);
   die();
}
$row1= mysqli_fetch_array($rs1);
Josejulio
  • 1,286
  • 1
  • 16
  • 30