I am trying to use stored procedure to execute the article query and I've googled from stackoverflow to php.net manual it seems I can not get to free_result the returned data set. Please note on a regular SQL statement this works fine but I need stored procedure for my project. Thank you
Code:
public static function getArticles() {
// clear the results
$items = '';
// Get the connection
$connection = Database::getConnection();
// Set up query this works ok
$query = 'SELECT * FROM `articles` ORDER BY title';
// this one doesn't
$query = "CALL sp_INSUPDEL_tbl_articles (0,'','',0,0,'',0,0,'title')";
$result_obj = '';
$result_obj = $connection->query($query);
try {
/*
the Commands out of sync; you can't run this command now happens this so If I have 20 results then 20 commands out of sync message is displayed. which is kinda annoying on client side :))
*/
while($result = $result_obj->fetch_object('Article')) {
$items[]= $result;
}
return($items);
}
............
/*
I even tried this but it does nothing
*/
try {
/* store first result set */
if ($result = $result_obj->store_result())
{
while($result = $result_obj->fetch_object('Article'))
{
$items[]= $result;
}
$result->free();
}
// pass back the results
return($items);
}