Ver Mensaje Individual
  #5 (permalink)  
Antiguo 31/05/2009, 23:23
Avatar de EmaD
EmaD
 
Fecha de Ingreso: marzo-2008
Mensajes: 93
Antigüedad: 16 años, 1 mes
Puntos: 2
Respuesta: Como optimizar consulta con randon

Listo ya lo logre , gracias por la ayuda .

Código PHP:
 $sql "SELECT COUNT(*) AS cant
    FROM videos"
;
    
    
    
    
$resp mysql_query($sql);
    
    
    
$aleatoriorand(0,$resp-1);
    
    
    
$sql2 "    SELECT
        id,
        title,
        id_author
    FROM videos
    LIMIT "
.$aleatorio.",1 ";
    
        
$result mysql_query($sql2);
        
        
                

                
           
$data mysql_fetch_array($result);
                            
                    
$title=remove_html(cut($data['title'],100));
                    
$title2=remove_html($data['title']);
                    
$paraenlace GetQuitarAcentos($title2);
                    
                    
$this->content.="    <center>                

<a href=\"VIDEO-"
.$data['id']."-".$paraenlace.".htm\" onMouseOver=\"return overlib('".$title2."', CAPTION, 'Tu Video Aleatorio')\" onMouseOut=\"return nd();\">";
                                
//$enlace = 'REVIEW'-'$data['id']'-'.$paraenlace.'.htm';
                    
$this->content.= $title.'';
                    
$this->content.= '<br><img src="images/rvideo.jpg">';

                    
$this->content.= '</a></center>';
                        
        
         
$this->content.="</p></div>"

Última edición por EmaD; 31/05/2009 a las 23:51