Re: Storing iterated results into various variables
| From: | Geckodeep | Date: | Tue, 04 Feb 2003 13:46:59 +0000 |
| Subject: | Re: Storing iterated results into various variables | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-25415@lists.php.net to get a copy of this message | ||
Here is a part of my code:
while ($image_row = mysql_fetch_array($result_images)){
$image1 = $image_row[0]["image1"];
if ($image1 == ""){
$image1 = $folder."logo.jpg";// it
places a log when there are no images
}
$caption1 = $image_row[0]["caption"];
}
This loop fetches the row and assigns the two variables $image1 and
$caption1 with its associated value from the fields in the 1st row.
How can I get the loop to fetch in the same way as above but from the 2nd
row and assigns the values to the new variable $image2 and $caption2 until
it reaches the 9th row with $image9 and $caption9?
thanks again
"Jason Wong" <php-db@gremlins.biz> wrote in message
news:200302042122.19518.php-db@gremlins.biz...
> On Tuesday 04 February 2003 20:02, Geckodeep wrote:
> > May be some one could help me here, I am trying to retrieve results from
a
> > table that gives 9 rows, from each row I am trying to pull out two
fields
> > and assign the two values of those column fields to a variable $image1
and
> > $caption1, and now I want to go to the next row and pick up the values
of
> > the corresponding fields and store it in the next variable $image2 and
> > $caption2 and to continue until I reach 9 rows.
> >
> > The reason for this technique is I am trying to inject the dynamic data
> > inside a page which is already formatted with HTMLs (kind of template)
and
> > by means of Php tags I can echo these variables where needed.
>
> What exactly are you having problems with? What is your code so far?
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-db
> ------------------------------------------
> /*
> Ah, sweet Springtime, when a young man lightly turns his fancy over!
> */
>