试图从MySQL访问PHP中的存储过程

So I created a stored procedure in phpMyAdmin named Ratio_Viewer. It takes in one parameter which is a stock ticker. I tested it in phpMyAdmin and I received the correct tuples. Now I am trying to incorporate that into my php files. I have a page where you enter a ticker and it takes you to another page which is supposed to display you the data based upon the stock ticker you entered. Nothing is getting returned. My code is:

require 'connection.php';
$sql = "CALL Ratio_Viewer('" . $_REQUEST["ticker"] . "')";

if(!$result = $mysqli->query($sql)) {
  echo "error: " . $mysqli->error . "<br>";
  exit;
}

echo ($result->fetch_assoc());

Your code is working.

echo ($result->fetch_assoc());

will simply print "Array". PHP does not print arrays in a readable format in this case.

You can use print_r or var_dump or implement a loop to print the data you want. For example,

foreach ($result->fetch_assoc() as $k => $v) echo "$k is $v <br>";

Your code is vulnerable to SQL injection.