Ver Mensaje Individual
  #8 (permalink)  
Antiguo 20/08/2007, 20:09
Avatar de shakaran
shakaran
 
Fecha de Ingreso: agosto-2005
Ubicación: España - Ciudad Real
Mensajes: 374
Antigüedad: 18 años, 8 meses
Puntos: 7
Re: ultimo dato en bd

GatorV en el manual de php no me aparece mysql_last_insertid() seguro que existe?

Código PHP:
$resul mysql_query(" SELECT COUNT(id) FROM tabla");
echo 
mysql_result($resul,0); 
Eso es muy lento, si quieres obtener realmente un indice(el total de filas) muy rapidamente la mejor manera es esta:
Código PHP:
$temp mysql_query("SELECT SQL_CALC_FOUND_ROWS * FROM table");
        
$result mysql_query("SELECT FOUND_ROWS()");
        
$total mysql_fetch_row($result); 
Otra cosa es que quieras obtener el ultimo indice insertado, entonces mysql_insert_id() es tu funcion ;)
__________________
Quijost Backend Engineer - www.quijost.com - Hosting rápido, eficiente y profesional
Blog: www.shakaran.net