I've seen plenty of examples of how to do this and for some reason non seem to work for me.

On test.php I have:

$result=get_dataset($db1,"call sp_filter_issues_reduced_view(".$subsectorid.",".$bondticker.",".$currencyid.",".$countryid.")");
$result2=get_dataset($db1,"call sp_filter_issues_reduced_view(".$subsectorid.",".$bondticker.",".$currencyid.",".$countryid.")");
var_dump($result2);

Yep, that is exactly the same query twice, this was just to test my theory there is something wrong with calling the function twice!

$result works correctly
$result2 shows: bool(false)

How is this possible, when they are exactly the same?

The function is as follows:

function get_dataset($db1, $query_string) {
//---------------------------------------------------------------------
$result1 = $db1->query($query_string);
$num_results = $result1->num_rows;

//$result8 = db_result_to_array($result1);
return $result1;
$query_string->free();
$result1->free();
$db1->close();
}

The connection string is as follows:

//----------------------------------------------------------------------
$server_name='xxx';
$user_name='xxx';
$password='xxx';
$database_name='xxx';
$db1= new mysqli($server_name, $user_name, $password, $database_name);
//----------------------------------------------------------------------

I am completely stuck on this, so would really appreciate any help!