Tuesday, 6 August 2013

How to grab latest image for current residents from MySQL using PHP

How to grab latest image for current residents from MySQL using PHP

I have a table that holds image information for every resident at my
facility. They have a new image taken each time they arrive and as such
have several images associated with their unique id. I need to be able to
retrieve only the most recent image for each resident.
Right now I am seeing an endless and inefficient series of loops to
achieve this.
$image = mysqli_query($link, "SELECT imagefilename, date_entered,
master_name_link FROM Images");
Each master_name_link can have numerous images associated with it.
I'm sure that I'm just not thinking this through as thoroughly as I could
be, but right now I'm stumped.

No comments:

Post a Comment