R
Rach
Guest
Hey Everyone,
What i am trying to do is display 6 different pictures and so far the only thing i can display is the same picture 6 times. The way i have my code right now shows the first picture 6 times. Here is what i have
<?php
$result = mysql_query("SELECT * FROM
categorypics order by id ");
while($row = mysql_fetch_array($result))
{
$products_image = $row["products_image"];
//products_image is the name of the field in the images table
}
echo ("<img src = ".$products_image." >");
?>
I am thinking the problem could be with mysql and how i am doing the url i am doing the following
id products_image
1 http://test.com/imgforcat/action.jpg
for each row i change the id and the products image so for the next one it would be
id products_image
2 http://test.com/imgforcat/dog.jpg
The problems is it will not go to the second image it just displays action.jpg 6 times instead of action.jpg,dog.jpg. So i am wondering how can i make it display 6 different images and also wondering is the problem with my php or mysql?
Thank you,
Rachel
What i am trying to do is display 6 different pictures and so far the only thing i can display is the same picture 6 times. The way i have my code right now shows the first picture 6 times. Here is what i have
<?php
$result = mysql_query("SELECT * FROM
categorypics order by id ");
while($row = mysql_fetch_array($result))
{
$products_image = $row["products_image"];
//products_image is the name of the field in the images table
}
echo ("<img src = ".$products_image." >");
?>
I am thinking the problem could be with mysql and how i am doing the url i am doing the following
id products_image
1 http://test.com/imgforcat/action.jpg
for each row i change the id and the products image so for the next one it would be
id products_image
2 http://test.com/imgforcat/dog.jpg
The problems is it will not go to the second image it just displays action.jpg 6 times instead of action.jpg,dog.jpg. So i am wondering how can i make it display 6 different images and also wondering is the problem with my php or mysql?
Thank you,
Rachel