I need to make an array in PHP from a table "artwork" that stores how many images there are and assigns a number to each image in a numeric sequence. I understand the concept but the how to is beyond me at this point.
Does anyone want to offer some help?
something like this:
<?php
$query = "SELECT image_url FROM artwork";
$result = mysql_query($query);
while($row = mysql_fetch_row($result)) {
$image_urls[] = $row[0];
}
foreach($image_urls as $key => $value) {
echo "key: $key url: $value<br />";
}
?>
See:
Please don't take it personally, but you have a talent of asking extremely ambiguous questions, with title contradicts with the body and with comments contradicts with them both.
What does mean "that stores how many images there are"? You need a number? Why array then? You need images? Why distinct "how many" then? Having an array implies that you ALWAYS can have a count of it's members.
Which images? Images returned by the query or ALL images stored in the database?
What's the point in having count(*) in the query?
Why can't you simply tell us, which kind of PHP page you are trying to write and thus get easy and complete answer implementing simple general purpose techniques and so have not a single problem to fight with?