TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   How to list rows except first one ? (http://www.talkphp.com/general/5417-how-list-rows-except-first-one.html)

CΛSTΞX 05-17-2010 08:19 PM

How to list rows except first one ?
 
Hello, how can I list rows except first one ? Thank you.

adamdecaf 05-17-2010 09:49 PM

If the array is numeric:

PHP Code:

$list = array(=> 'adam'=> 'dave');
$length count($list);

for (
$n 1$n $lengthn++) {
   echo 
$list[$n];



CΛSTΞX 05-17-2010 09:53 PM

Thanks. But I mean the mysql results. My query is this >

$query="select * from dle_post where $q ORDER BY id DESC limit 10";

I mean how to list items except first one...

adamdecaf 05-17-2010 10:04 PM

Then just pull the data normally and put in a numeric array. That way you can print off the array from the 2nd element.

PHP Code:

$result mysql_query('SELECT * ... ');
$list = array();

while (
$row mysql_fetch_array($result)) {
   
$list[] = $row;



CΛSTΞX 05-17-2010 11:01 PM

Sorry but can't understand. What you exactly mean ?

etoolbox 05-17-2010 11:08 PM

Is this what you want?

$query="select * from dle_post where $q ORDER BY id DESC limit 1, 10";

CΛSTΞX 05-17-2010 11:11 PM

If its showing last 10 results except the first one, yes its is.

nefus 05-18-2010 02:46 PM

The limit on the end of the sql query keeps it from showing the first record because it's 1 instead of 0.

core1024 05-22-2010 02:26 PM

you can even
PHP Code:

$r mysql_query('SELECT no, matter FROM whatever WHERE something');
mysql_fetch_assoc($r)
while (
$row mysql_fetch_assoc($r)) {
   echo 
'<pre>'.print_r($row,true).'</pre>';




All times are GMT. The time now is 04:07 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0