holdaway
01-28-2008, 10:32 PM
I am currently trying out loading images and pictures into Flash via PHP. Everything works fine with 1 image and 1 piece of text, but of course what I want to do is build a list of items, each with a picture and text to go with it.
This is the code after the general connecting code:
$outcome = mysql_query("SELECT eventImage,eventTitle, eventText FROM conferences1 WHERE id_num = '1'");
if (!$outcome) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$row = mysql_fetch_row($outcome);
echo $row[0]; // image name
echo $row[1]; // conference title
echo $row[2]; // conference text
// echo the variables
echo ("&confImage=$row[0]");
echo ("&confTitle=$row[1]");
echo ("&confText=$row[2]");
So after this, I just tell Flash to look for the variables 'confImage','confTitle' and 'confText'. Of course right now, it is only set to look on row 1 of the database. What I need to know is how to retrieve row items from the database and dynamically re-name them so that for example the picture names would become: &confImage1, $confImage2, etc.
So it looks as though I need to create a loop of some sort to toggle through all the rows and add a number to them. Anyone know how to help or have a handy link to a tutorial? Lots of links on how to make loops but haven't found any that deal with using a loop to re-name(declare) variables.
This is the code after the general connecting code:
$outcome = mysql_query("SELECT eventImage,eventTitle, eventText FROM conferences1 WHERE id_num = '1'");
if (!$outcome) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$row = mysql_fetch_row($outcome);
echo $row[0]; // image name
echo $row[1]; // conference title
echo $row[2]; // conference text
// echo the variables
echo ("&confImage=$row[0]");
echo ("&confTitle=$row[1]");
echo ("&confText=$row[2]");
So after this, I just tell Flash to look for the variables 'confImage','confTitle' and 'confText'. Of course right now, it is only set to look on row 1 of the database. What I need to know is how to retrieve row items from the database and dynamically re-name them so that for example the picture names would become: &confImage1, $confImage2, etc.
So it looks as though I need to create a loop of some sort to toggle through all the rows and add a number to them. Anyone know how to help or have a handy link to a tutorial? Lots of links on how to make loops but haven't found any that deal with using a loop to re-name(declare) variables.