I am trying to set the two outputs from this MySQL stored procedure as PHP variables:
$result = mysql_query("CALL mst2('$q', @eset, @leng)");
if (!$result) {
die('Invalid query: ' . mysql_error());
}
while($row = @mysql_fetch_assoc($result))
{
debug($row);
}
$eset = $row->{'@eset'};
$length= $row->{'@leng'};
The last two line are throwing an error Trying to get property of non-object . Does anybody know the proper way to do this?
$rowis an associative array so you need to use$row['indexName']to access the values stored there.mysql_functions are now deprecated, you should be usingmysqli_instead.Undefined variable: row', I guess you can't reference the associative array outside of the loop. When I put the statement inside the loop though, the$eset` doesn't get set to the proper value, it instead remains the default value which is''