Re: Display just 1 record in a query
| From: | Ryan Sun | Date: | Tue, 12 Jan 2010 21:59:33 +0000 |
| Subject: | Re: Display just 1 record in a query | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-301044@lists.php.net to get a copy of this message | ||
though you can fetch twice to get the 2nd row
$row_cur = mysql_fetch_assoc($cur); //skip 1st row
$row_cur = mysql_fetch_assoc($cur);
echo $row_cur['tid'];
you should really modify your sql statement, like 'select xxx from xx order
by xx limit 1, 1' (limit 1,1 retrieve your 2nd row if you are using mysql)
On Tue, Jan 12, 2010 at 4:52 PM, dealtek@gmail.com <dealtek@gmail.com>wrote:
> I did a query... then I display records like:
>
> <table>
> <?php do { ?>
> <tr>
> <td><?php echo $row_cur['tid']; ?></td>
> <td> </td>
> </tr>
> <?php } while ($row_cur = mysql_fetch_assoc($cur)); ?>
> </table>
>
>
> Q: but how I i just display a particular record with out the do / while
> loop?
>
> like just the 2nd record only:
>
> i tried
> <?php echo $row_cur['tid',2]; ?>
> but this makes an error....
>
> or $row_cur('tid',2) --- hmmm what's the syntax?
>
>
>
> Thanks,
> dealtek@gmail.com
> [db-10]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>