Source Code index.php Ajax Multiple Image Upload with Edit Delete using PHP Mysql

Ajax Multiple Image Upload with Edit Delete using PHP Mysql


Only .jpg, png, .gif file allowed

database_connection.php fetch.php prepare($query); $statement->execute(); $result = $statement->fetchAll(); $number_of_rows = $statement->rowCount(); $output = ''; $output .= ' '; if($number_of_rows > 0) { $count = 0; foreach($result as $row) { $count ++; $output .= ' '; } } else { $output .= ' '; } $output .= '
Sr. No Image Name Description Edit Delete
'.$count.' '.$row["image_name"].' '.$row["image_description"].'
No Data Found
'; echo $output; ?> upload.php 0) { //$output = ''; sleep(3); for($count=0; $countprepare($query); $statement->execute(); } } } function file_already_uploaded($file_name, $connect) { $query = "SELECT * FROM tbl_image WHERE image_name = '".$file_name."'"; $statement = $connect->prepare($query); $statement->execute(); $number_of_rows = $statement->rowCount(); if($number_of_rows > 0) { return true; } else { return false; } } ?> edit.php prepare($query); $statement->execute(); $result = $statement->fetchAll(); foreach($result as $row) { $file_array = explode(".", $row["image_name"]); $output['image_name'] = $file_array[0]; $output['image_description'] = $row["image_description"]; } echo json_encode($output); ?> update.php prepare($query); $statement->execute(); } function get_old_image_name($connect, $image_id) { $query = " SELECT image_name FROM tbl_image WHERE image_id = '".$image_id."' "; $statement = $connect->prepare($query); $statement->execute(); $result = $statement->fetchAll(); foreach($result as $row) { return $row["image_name"]; } } ?> delete.php prepare($query); $statement->execute(); } } ?> Database -- -- Database: `testing` -- -- -------------------------------------------------------- -- -- Table structure for table `tbl_image` -- CREATE TABLE IF NOT EXISTS `tbl_image` ( `image_id` int(11) NOT NULL, `image_name` varchar(250) NOT NULL, `image_description` varchar(250) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; -- -- Indexes for table `tbl_image` -- ALTER TABLE `tbl_image` ADD PRIMARY KEY (`image_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `tbl_image` -- ALTER TABLE `tbl_image` MODIFY `image_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;