Slammer Posted December 28, 2006 Report Share Posted December 28, 2006 $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. Link to comment Share on other sites More sharing options...
andrisp Posted December 28, 2006 Report Share Posted December 28, 2006 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 ? Link to comment Share on other sites More sharing options...
Slammer Posted December 28, 2006 Author Report Share Posted December 28, 2006 Paldies $sql = "SELECT max(`id`) as max_id FROM `statistic`"; $sql = mysql_query($sql); $row = mysql_fetch_array($sql); echo $row["max_id"]; Link to comment Share on other sites More sharing options...
bubu Posted December 28, 2006 Report Share Posted December 28, 2006 Neaizmirstam arī par mysql_fetch_row: $sql = "SELECT max(id) FROM statistic"; $row = mysql_fetch_row(mysql_query($sql)); echo $row[0]; Link to comment Share on other sites More sharing options...
Recommended Posts