xmas12 Posted August 7, 2010 Report Share Posted August 7, 2010 (edited) Sveiki, man izvelk no tabulas konkursa uzvaretajus, piemeram no lielaka uz mazako skaitli, un ar limit 5, bet daziem ir taja konkursa 13 skaitlis, bet vins to neizvelk, bet citiem to skaitli izvelk.. Kods: <?php $result = mysql_query("SELECT * FROM users ORDER BY konkurss DESC limit 5"); while($row = mysql_fetch_array($result)) { echo '<tr> <td align="center" bgcolor="#2E2E2E">#</td> <td align="left" valign = "top" bgcolor="#2E2E2E"><b>' . $row['username'] . '<a></b></td> <td bgcolor="#2E2E2E">' . $row['konkurss'] . '</td></tr>'; } echo '</td></tr> </table>'; ?> Kpc viņš neizvelk tos skaitļus ? Edited August 7, 2010 by xmas12 Quote Link to comment Share on other sites More sharing options...
101111 Posted August 7, 2010 Report Share Posted August 7, 2010 Kopā ar limit jānorāda sākot ar kuru ierakstu un cik lielā skaitā ierakstus izvilkt. Lai dabūtu pirmos 5 ierakstus būtu šitādi: $result = mysql_query("SELECT * FROM users ORDER BY konkurss DESC limit 0,5"); Quote Link to comment Share on other sites More sharing options...
xmas12 Posted August 7, 2010 Author Report Share Posted August 7, 2010 Kopā ar limit jānorāda sākot ar kuru ierakstu un cik lielā skaitā ierakstus izvilkt. Lai dabūtu pirmos 5 ierakstus būtu šitādi: $result = mysql_query("SELECT * FROM users ORDER BY konkurss DESC limit 0,5"); tapat neiet, kr4 man izvelk tikai dazus userus kuri ir topa. piemeram tam kuram ir 13 cipars ieks datubazes, to neizvelk, bet kuram ir 8 vai citi, tos izvelk ... kpc ta ? Quote Link to comment Share on other sites More sharing options...
nemakuphp Posted August 7, 2010 Report Share Posted August 7, 2010 Parādi savu datubāzes struktūru Quote Link to comment Share on other sites More sharing options...
xmas12 Posted August 7, 2010 Author Report Share Posted August 7, 2010 CREATE TABLE IF NOT EXISTS `tb_users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(15) COLLATE latin1_general_ci NOT NULL, `password` varchar(100) COLLATE latin1_general_ci NOT NULL, `ip` varchar(15) COLLATE latin1_general_ci NOT NULL, `email` varchar(150) COLLATE latin1_general_ci NOT NULL, `pemail` varchar(150) COLLATE latin1_general_ci NOT NULL, `referer` varchar(15) COLLATE latin1_general_ci NOT NULL, `country` varchar(150) COLLATE latin1_general_ci NOT NULL, `visits` varchar(150) COLLATE latin1_general_ci NOT NULL DEFAULT '0', `referals` varchar(150) COLLATE latin1_general_ci NOT NULL DEFAULT '0', `referalvisits` varchar(150) COLLATE latin1_general_ci NOT NULL DEFAULT '0', `money` varchar(150) COLLATE latin1_general_ci NOT NULL DEFAULT '0.00', `paid` varchar(150) COLLATE latin1_general_ci NOT NULL DEFAULT '0.00', `joindate` varchar(150) COLLATE latin1_general_ci NOT NULL, `lastlogdate` varchar(150) COLLATE latin1_general_ci NOT NULL, `lastiplog` varchar(150) COLLATE latin1_general_ci NOT NULL, `account` varchar(150) COLLATE latin1_general_ci NOT NULL, `user_status` varchar(15) COLLATE latin1_general_ci NOT NULL DEFAULT 'user', `piesaistes_konkurss` varchar(100) COLLATE latin1_general_ci NOT NULL DEFAULT '0', KEY `id` (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=256 ; Quote Link to comment Share on other sites More sharing options...
vertex Posted August 7, 2010 Report Share Posted August 7, 2010 Liec to tabulu kā INT. Tad viss ies Quote Link to comment Share on other sites More sharing options...
xmas12 Posted August 7, 2010 Author Report Share Posted August 7, 2010 Liec to tabulu kā INT. Tad viss ies viss iet, paldies, es muļķis ... :D nafig uzreiz neliku int :d 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.