I am creating a simple blog site, by creating a new page I have also inserted an image gallery. the page and the gallery both have two different tables because I couldn’t figure out how to put a gallery in a single table (meaning a gallery section in the page table, so I created two tables)
What I’m trying to achieve in update pages is to check if the image is inserted in the update page or not. if the image is inserted, display the image, else allow the user to upload the image in the update page
table_name = english_version (table for the page)
table_name = english_gallery (table for gallery)
gallery_id | image_id | image |
---|
*Where image_id = id (id of English version)
So, when the user creates a new page and a new element, he is sent to the update page:
header(“Location:./update.php?update=$lasterid”);
die();
so if user forget to insert image for gallery i want to give image upload option in update pages…
if(isset($_GET['update'])){
$update_id = intval($_GET['update']);
$update = $conn->query("SELECT * FROM english_version WHERE id = $update_id ");
while($rows = $update->fetch(PDO::FETCH_OBJ) ):
$id = $rows->id;
$title = $rows->title;
$content = $rows->content;
endwhile;
}
check if image is inserted or not
if($image_id == $update_id ){
if there is an image, its image is displayed but if there is no image, it does not display the input option for image upload
if think other conditions does not work because $image_id stores id of (primary_key) english_version (table for page)) it checks the id which is never created…
so how can i get the condition, where if the user has inserted an image, the image will be displayed, else the user will have the option to upload image…