hola tengo un problema al ordenar un array o arreglo con los resultados de mi db
aqui el codigo
Código PHP:
function getLastPosts($type = 'visited'){
$tsUser = User::getInstance();
$db = Controller::getInstance();
$data = array();
$query = $db->select_up("u_portal","last_posts_{$type}","user_id = {$tsUser->uid}","",1);
$dato = $db->fetch_assoc($query);
$db->free($query);
//$visited = serialize( $dato['last_posts_'.$type]);
$visited = array("visited" => serialize($dato['last_posts_'.$type]));
ksort($visited);
// LO HAGO ASI PARA ORDENAR SIN NECESITAR OTRA VARIABLE
foreach($visited as $key => $id){
$query = $db->query("SELECT p.post_id, p.post_user, p.post_category, p.post_title, p.post_date, p.post_comments, p.post_puntos, p.post_private, u.user_name, c.c_nombre, c.c_seo, c.c_img FROM p_posts AS p LEFT JOIN u_miembros AS u ON p.post_user = u.user_id LEFT JOIN p_categorias AS c ON c.cid = p.post_category WHERE p.post_status = 0 AND p.post_id = {$id} LIMIT 1");
$data[] = $db->fetch_assoc($query);
$db->free($query);
}
//
return $data;
}
el error que me da
Código HTML:
Warning: mysql_free_result() expects parameter 1 to be resource, boolean given