$sql = "SELECT MAX(id)+1 as Proximo FROM tabla "; $q = mysql_query($sql); $row = mysql_fetch_assoc($q); $proximo = $row['Proximo'];