Okay i'm getting the basics of php but I have no idea where to even start to code this
idea... I have a database "DB_Name" and a table "images"
This table has the following columns (id, category, image name, image path, caption)
Keep in mind all my images are stored in a folder (NOT in the DB)
so the information in the DB would look like this.
(1, category1, image1.jpg, images/, caption discription)
this is what i'm trying to accomplish, I want to be able to delete the images from the folder and the database.
1. Query the database and display the categories listed in the 'category' as a hyperlink so that i may select certain categories to browse through to delete images only in that category.
I believe this code should do this just fine. but i haven't tested it yet so if you see any mistakes let me know.
Display categories to choose from:
<?php include 'config.php'; // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql = mysql_query("SELECT id,category FROM images ORDER BY category"); $row = mysql_fetch_array($sql); while($row = mysql_fetch_array($sql)); echo <a href="displaycategory.php?name=$row">$row</a> ?>
2. when the hyperlink is clicked i want to query the database and display all of the images with that specific category name using pagination. I also want a delete hyperlink displayed under each image.
3. when the delete hyperlink is clicked i want it to remove the image from the folder & the Database..
Can anyone point me in the right direction or if you have some example code i could use to put it all together. any help would be greatly appreciated.