I have a table 'account' (id, email, pass) in MySQL database.
I have stored procedure:
DELIMITER $$
CREATE PROCEDURE `LoadAccount`(email_p VARCHAR(100))
BEGIN
SELECT pass FROM account WHERE email = email_p;
END$$
DELIMITER ;
And here's the code:
function loadAccount($email, $pass)
{
// connect to DB
// ...
$query = "CALL LoadAccount('{$email}')";
if ($mysqli->multi_query($query))
{
do
{
if ($result = $mysqli->store_result())
{
// Numbered array.
while ($row = $result->fetch_array(MYSQLI_NUM))
{
printf("%s %s\n", $row[0]);
}
// Associative array.
// while ($row = $result->fetch_array(MYSQLI_ASSOC))
// {
// printf("%s\n", $row['pass']);
// }
$result->free();
}
$mysqli->more_results();
} while ($mysqli->next_result());
}
}
So, Numbered array section works, but if I comment it out and uncomment Associative array section — the page just hangs and loses connection.
Why doesn't it work?