Jump to content
php.lv forumi

Recommended Posts

Posted

$sql = "SELECT max(`id`) FROM `statistic`";

$sql = mysql_query($sql);

while($row = mysql_fetch_array($sql)){

echo $row["id"];

}

 

Kapē neuzrāda manējo lielāko id vērtību? Paldies.

Posted

Kverijs ir ok, bet pie echo id indeks ir neeksistējošs. Uztaisi print_r($row);

 

Pamēģini:

SELECT max(`id`) as max_id FROM `statistic`

 

PS. Kas tā par modi rezultsetus, kur būs tikai viena rinda, apstaigāt ar while ?

Posted

Paldies

 

$sql = "SELECT max(`id`) as max_id FROM `statistic`";
$sql = mysql_query($sql);
$row = mysql_fetch_array($sql);
echo $row["max_id"];

×
×
  • Create New...