Hi everybody, I am doing an Imaging website project and well so far I load image information such as Image name, Image path (/image/theimage.jpg) etc. into my “Images class” and into an array.
$result = $conn->query("select * from Image where User_Name='$username' and Image.Image_Edit=0");
$result->num_rows;
if (!$result)
throw new Exception('Could not execute query');
if ($result->num_rows>0)
{
//$_SESSION['NewImages'] = array();
$num_results = $result->num_rows;
for ($i=0; $i <$num_results; $i++)
{
$row = $result->fetch_assoc();
$Image_ID = $row['Image_ID'];
$Path = $row[‘Path’];
$_SESSION['NewImages'][$i]=new Images($Image_ID,$Path);
}
I put the class Images into an array because one user can have several Images, moreover its a session variable because the user will use this session variable several times in a few pages (maybe) . I obviously have far more variables in my database as well.
I also wrote a small function to get the data out of the array to display it.. this was only to test to see if my class etc. actually works…
foreach($_SESSION['NewImages'] as $index=>$value){
$Image_ID=$value->Image_ID;
$Image_Thumbpath=$value->Image_Thumbpath;
echo "<tr><td>$Image_ID</td>";
echo "<td>$Image_Thumbpath</td>";
}
OK my question is this: I would like to allow the user to view 10 images as thumbnails on one page, when he clicks “next page” he will see the next 10 images etc. until no more images are left.
What is the easiest way to implement this?
And another point, if the user would like to edit one image in the array whats the easiest method to do this. I would like to use to be able to click a thumbnail then allow the user to edit the variables in the class and then go back to the browse section… or the user could select several Images (by clicking a selection box) and then edit several Images at ones…
Whats the best way to implement this??
I have some ideals on how to implement the above ideals but the thing is I am a php noob and I am not to good with programming and any help, ideals, tips and links are greatly appreciated!!!! And I know this is quite complicated (I suppose)
I am doing this for my final year project at university so any help is appreciated, and code examples will be very appreciated.
Many thanks