Page 1 of 1

mysql_fetch_array($result) ??

Posted: Tue Jan 28, 2003 4:21 am
by fluff
Hi, Does anyone know how I can use the above function twice in one page on the same query?

At the top of the page I have something like the following....
#-----------------------------
$DBresults=mysql_fetch_array($result)
$LastModified= $DBresults['lastModified'];
#----------------------------

But then further down the page I want to use a loop to return multiple assignments of variables, but if I try to retrieve them using...
#-----------------------------
$comments=mysql_fetch_array($result)
$comments= $DBresults['comments'];
#----------------------------

I do not get the results I require. If I comment out the first instance, there isn't a problem ???

Is there another way of doing this :?:
Thanks

Posted: Tue Jan 28, 2003 3:11 pm
by Joan Garnet
kepp the value in a variable and then use it whenever you want.

Code: Select all

$DBresults=mysql_fetch_array($result) 
$LastModified= $DBresults['lastModified'];
$comments= $DBresults['comments'];
.
.
.
.
.
echo $comments;


Does it help?