Re: Display just 1 record in a query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2010-01-12 at 13:52 -0800, dealtek@xxxxxxxxx wrote:

> I did a query... then I display records like:
> 
> <table>
>    <?php do { ?>
>      <tr>
>        <td><?php echo $row_cur['tid']; ?></td>
>        <td>&nbsp;</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@xxxxxxxxx
> [db-10]
> 
> 


Depends on how you're creating running the query. You could do something
like:

echo mysql_result($result, 1, 'fieldname');

Where $result is your result object and 1 is a 0 indexed array, so would
be the second result.

Thanks,
Ash
http://www.ashleysheridan.co.uk



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux