Code: Select all
<?php
// Count the number of images
$query = "select Count(*) from images order by id ASC";
$result = mysql_query ($query) or die(mysql_error());
$row = mysql_fetch_array ($result, MYSQL_NUM);
$num_pics = $row[0];
// Get filename
$query = "select (select count(*) from images) as count, filename from images order by id ASC";
$result = mysql_query ($query) or die(mysql_error());
$row1 = mysql_fetch_array ($result, MYSQL_NUM);
$i=0;
while ($i<$num_pics) {
echo "Pic[".$i."] = 'Images/SlideshowMain/".$row1['filename']'";
$i++;
};
?>
...(the rest of the javascript and the rest of the page follows...)
Here are my questions:
I realize the main problem is that the apostrphes are not right. Close but not right. I think I need to put a backslash in there to cancel the double quote or forward slash or something. I played with it but can't quite get it.
Also, I think doing a double query is messing this up. I played with a few ideas but couldn't find another way to get the two pieces of information (the count of images which will change each time and the filenames).
The goal is to get it to look something like this:
Code: Select all
Pic[0] = 'Images/SlideshowMain/frogimage.png'
Pic[1] = 'Images/SlideshowMain/brittanywall.png'
Pic[2] = 'Images/SlideshowMain/craigriver.png'
Pic[3] = 'Images/SlideshowMain/destinyboat.png'
Pic[4] = 'Images/SlideshowMain/sarahface.png'
Pic[5] = 'Images/SlideshowMain/destinytracks.png'
Pic[6] = 'Images/SlideshowMain/edbrittany.png'
Pic[7] = 'Images/SlideshowMain/hannaharm.png'
Pic[8] = 'Images/SlideshowMain/hannahtree.png'
Pic[9] = 'Images/SlideshowMain/judithsmile.png'
Pic[10] = 'Images/SlideshowMain/judithtree.png'
Pic[11] = 'Images/SlideshowMain/londonbw.png'
Pic[12] = 'Images/SlideshowMain/sarahhand.png'
Pic[13] = 'Images/SlideshowMain/londonflower.png'
Pic[14] = 'Images/SlideshowMain/londonyard.png'
Pic[15] = 'Images/SlideshowMain/samdock.png'
Pic[16] = 'Images/SlideshowMain/samflower.png'
Pic[17] = 'Images/SlideshowMain/samhat.png'
Pic[18] = 'Images/SlideshowMain/sampurple.png'
Pic[19] = 'Images/SlideshowMain/samreflection.png'
Pic[20] = 'Images/SlideshowMain/samrock.png'
Pic[21] = 'Images/SlideshowMain/samsmile.png'
Pic[22] = 'Images/SlideshowMain/samthrow.png'