I'm trying to return four records from my MySQL database but only the first record is being returned. I've searched but I'm unsure why this is. Can someone point me in the right direction?
<?php
session_start();
function displayImage($username){
$imageDate = $_POST['imageDate'];
$result = mysql_query("
SELECT
imageName
FROM
images AS i
INNER JOIN
users AS u ON i.userID = u.UserID
WHERE
u.username = '$username'
AND
i.imageDate = '$imageDate'
") or die(mysql_error());
//return a message to the users explaining ......
if (!isset($_POST['Submit'])) {
// this does nowt yet!!!
$output = "Nothing selected yet.";
}
else {
//This is a while loop to store the SQL results into ......
$row = array(mysql_fetch_assoc($result));
foreach ($row as $picName) {
$cam = $_POST['cam'];
$fullPath = $username . "/" . $cam . "/" . $picName['imageName'];
// $output = //this works fine
reset($images);
}
}
var_dump($row);
echo "<br />";
return $output;
}
?>