toms42 Posted April 29, 2010 Report Share Posted April 29, 2010 Sveiki, ka redzet attēlā es izvadu datus no DB, bet viņi kartojas kā paši grib, kā lai panāk lai datus kartotu piemēram pēc ID? Kods: http://paste.php.lv/7d6f1b12756b6d266327e66364aae77b?lang=php Quote Link to comment Share on other sites More sharing options...
zintis8789 Posted April 29, 2010 Report Share Posted April 29, 2010 (edited) $sql="SELECT * FROM $tbl_name ORDER BY id"; Ja tu gribi augoshaa secibaa tad: $sql="SELECT * FROM $tbl_name ORDER BY id DESC"; Ja no zemaakaa uz lielaako tad: $sql="SELECT * FROM $tbl_name ORDER BY id ASC"; Edited April 29, 2010 by zintis8789 Quote Link to comment Share on other sites More sharing options...
fish Posted April 29, 2010 Report Share Posted April 29, 2010 (edited) $sql="SELECT * FROM $tbl_name ORDER BY id"; :) nepaspēju... Edited April 29, 2010 by fish Quote Link to comment Share on other sites More sharing options...
ABU Posted April 29, 2010 Report Share Posted April 29, 2010 zintis8789, nestāsti muļķības par kārtošanu. Lai sarakstu kārtotu augošā secībā, tad jābūt atslēgas vārdam ir jābūt ASC, bet lai dilstošā secībībā - DESC. Piemēros: augošā secībā (no mazākā uz lielāko): $sql="SELECT * FROM $tbl_name ORDER BY id ASC"; dilstošā secībā (no lielākā uz mazāko): $sql="SELECT * FROM $tbl_name ORDER BY id DESC"; Quote Link to comment Share on other sites More sharing options...
toms42 Posted April 29, 2010 Author Report Share Posted April 29, 2010 Paldies :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.