Re: [PHP] Display just 1 record in a query

2010-01-12 Thread Robert Cummings
Jochem Maas wrote: Op 1/13/10 12:43 AM, Robert Cummings schreef: deal...@gmail.com wrote: On Jan 12, 2010, at 1:57 PM, Ashley Sheridan wrote: Depends on how you're creating running the query. You could do something like: echo mysql_result($result, 1, 'fieldname'); Where $result is your res

Re: [PHP] Display just 1 record in a query

2010-01-12 Thread Jochem Maas
Op 1/13/10 12:43 AM, Robert Cummings schreef: > > deal...@gmail.com wrote: >> On Jan 12, 2010, at 1:57 PM, Ashley Sheridan wrote: >> >>> Depends on how you're creating running the query. You could do >>> something like: >>> >>> echo mysql_result($result, 1, 'fieldname'); >>> >>> Where $result is

Re: [PHP] Display just 1 record in a query

2010-01-12 Thread Robert Cummings
deal...@gmail.com wrote: On Jan 12, 2010, at 1:57 PM, Ashley Sheridan wrote: 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 r

Re: [PHP] Display just 1 record in a query

2010-01-12 Thread deal...@gmail.com
On Jan 12, 2010, at 1:57 PM, Ashley Sheridan wrote: 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 Ryan, Ashl

Re: [PHP] Display just 1 record in a query

2010-01-12 Thread Kim Madsen
Daevid Vincent wrote on 13/01/2010 00:00: Holy, Jesus, Marry and Joseph! You can't be serious with that?! So you're going to loop over potentially hundreds or thousands of records and only display one? Wow. Speechless. Either you're talking to dealtek or you didn't read my post very well: "An

RE: [PHP] Display just 1 record in a query

2010-01-12 Thread Daevid Vincent
> -Original Message- > From: Kim Madsen [mailto:php@emax.dk] > Sent: Tuesday, January 12, 2010 2:17 PM > To: deal...@gmail.com > Cc: php-general@lists.php.net > Subject: Re: [PHP] Display just 1 record in a query > > deal...@gmail.com wrote on 12/01/2010

Re: [PHP] Display just 1 record in a query

2010-01-12 Thread Kim Madsen
deal...@gmail.com wrote on 12/01/2010 22:52: I did a query... then I display records like:   Q: but how I i just display a particular record with out the do / while loop? Just use extract($row_cur); before the table starts. That would give you first row onl

Re: [PHP] Display just 1 record in a query

2010-01-12 Thread Ashley Sheridan
On Tue, 2010-01-12 at 13:52 -0800, deal...@gmail.com wrote: > I did a query... then I display records like: > > > > > >  > > > > > > Q: but how I i just display a particular record with out the do / > while loop? > > like just the 2nd record only: > >

Re: [PHP] Display just 1 record in a query

2010-01-12 Thread Ryan Sun
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 usin