Got a really simple problem (almost embarassed to post this).
I want to load up some image captions from a mysql database and then put those values into an array, to be used later on it the script....thats it! But I'm struggling and after searching, still cant find anything to help so trying my luck here.
Here's my code:
$result = mysql_query("SELECT * FROM countryImages WHERE country = '$country' ");
while($myrow = mysql_fetch_array($result)){
$caption = $myrow["caption"];
//trying to put the resulting rows into an array
$myArray = array();
array_push($myArray, $caption);
}
//testing to see if the array works
echo "myArray[0]: $myArray[0]";
Now from theres 4 resulting rows but using the above code, only the caption from the last row actually works, if i test that last echo to say:
echo "myArray[0]: $myArray[1]";
I get nothing.
I've tried searching for various array functions but couldn't find any examples to help me. Can anyone help? Sure this is something really simple for you experts out there!