soimuletzu1 Posted July 11, 2011 Report Posted July 11, 2011 Salutare, am si eu o problema la un mic script .... incerc sa extrag din baza de date ultimul id de la o lista de siteuri (ii la un topsites) da problema ii ca imi afiseaza toate idurile ...Scriptul e urmatorul:<?php//conexiune$afisare=mysql_query("SELECT * FROM ts_sites");?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="51%" scope="col">Idul siteului</td> </tr> <?phpwhile ($row=mysql_fetch_row($afisare)) { //variabilele definite $id = $row[0];?> <tr> <td><? echo "$id"; ?></td> </tr> <?php } ?> </table>Cum ar trebui sa folosesc functia de extragere incat sa selecteze doar ultimul id?Rog sa raspunda cei care cunosc .. si multumesc frumos! Quote
UnixDevel Posted July 11, 2011 Report Posted July 11, 2011 <?php//conexiune$afisare=mysql_query("SELECT * FROM ts_sites order by id desc limit 1");?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="51%" scope="col">Idul siteului</td> </tr> <?phpwhile ($row=mysql_fetch_row($afisare)) { //variabilele definite $id = $row['id'];?> <tr> <td><? echo "$id"; ?></td> </tr> <?php } ?> </table> 1 Quote
UnixDevel Posted July 11, 2011 Report Posted July 11, 2011 npc ,daca mai ai nevoie de ajutor da add la bogdan.izdrail ,nu ma dau eu mare dar stiu o tzira de php Quote