POSTING WAS SUCCESSFUL"; $last_id = mysqli_insert_id($conn); } if((isset($_REQUEST['action']))&&($_REQUEST['action']=="del")){ $id = mysqli_escape_string($conn, $_REQUEST['id']); // DELETE PHYSICAL FILE $query = "SELECT image_name FROM post WHERE id ='$id'"; $result = mysqli_query($conn, $query) or die(mysqli_error($conn)); $info = mysqli_fetch_array($result); $f_name= $info['image_name']; if(file_exists("piks/".$f_name)) { unlink("piks/".$f_name); }else{ } $query = "DELETE FROM post WHERE id = '$id'"; mysqli_query($conn, $query) or die(mysqli_error($conn)); $msg="Record deleted"; } if(isset($_REQUEST['editing'])){ $select_id = mysqli_escape_string($conn, $_REQUEST['id']); $sql = "SELECT * FROM post WHERE id='$select_id'"; $result = mysqli_query($conn, $sql) or die(mysqli_error($conn)); $info = mysqli_fetch_array($result); $id=$info['id']; $image_name=$info['image_name']; $title=$info['title']; $date_day=$info['date_day']; $date_month=$info['date_month']; $date_year=$info['date_year']; //$body=strip_tags($info['body']); $body=$info['body']; $posted_by=$info['posted_by']; $artist_id=$info['artist_id']; } if(isset($_REQUEST['edit_id'])){ $edit_id = mysqli_escape_string($conn, $_REQUEST['edit_id']); $title = mysqli_escape_string($conn, $_REQUEST['title']); $category_series = mysqli_escape_string($conn, $_REQUEST['type']); $date_day = mysqli_escape_string($conn, $_REQUEST['date_day']); $date_month = mysqli_escape_string($conn, $_REQUEST['date_month']); $date_year = mysqli_escape_string($conn, $_REQUEST['date_year']); $artist = mysqli_escape_string($conn, $_REQUEST['artist']); $comm3 = mysqli_escape_string($conn, $_REQUEST['body']); $sql1 = "UPDATE post SET title = '$title', category = '$category_series', date_day = '$date_day', date_month = '$date_month', date_year = '$date_year', artist_id = '$artist', body = '$comm3' WHERE id = '$edit_id'"; mysqli_query($conn, $sql1) or die(mysqli_error($conn)); //Update $msg="EDITING WAS SUCCESSFUL"; } ?>
required />
Format: PNG, BMP, GIV, JPG or JPEG
"; if(isset($_REQUEST['editing'])){ $select_id = mysqli_escape_string($conn, $_REQUEST['id']); print ""; print ''; }else{ print ' '; } ?>
Record
Id Type Image Title Date Body "; // print the random numbers while($info = mysqli_fetch_array($result)) { $id=$info['id']; $artist_id=$info['artist_id']; $image_name=$info['image_name']; $title=$info['title']; $date_day=$info['date_day']; $date_month=$info['date_month']; $date_year=$info['date_year']; $body=$info['body']; $posted_by=$info['posted_by']; $category=$info['category']; $limit_body = substr($body, 0, 300)."..."; $limit_body = str_replace("\n", '
', $limit_body); $query_more = "SELECT * FROM post_more_picture WHERE art_id = '$id' ORDER BY id DESC"; $result_more = mysqli_query($conn,$query_more) or die(mysqli_error($conn)); $more = mysqli_num_rows($result_more); print " $id $category $image_name
Add/Change Picture ($more) $title $date_day/$date_month/$date_year $limit_body "; print "Edit | Delete"; print " "; } //close up ther table print "

"; // how many rows we have in database $query = "SELECT COUNT(id) AS numrows FROM post WHERE category = '$type'"; $result = mysqli_query($conn,$query) or die(mysqli_error($conn)); $row = mysqli_fetch_array($result); $numrows = $row['numrows']; // how many pages we have when using paging? $maxPage = ceil($numrows/$rowsPerPage); // print the link to access each page $self = $_SERVER['PHP_SELF']; $nav = ''; for($page = 1; $page <= $maxPage; $page++) { if ($page == $pageNum) { $nav .= " $page "; // no need to create a link to current page } else { $nav .= " $page "; } } // creating previous and next link // plus the link to go straight to // the first and last page if ($pageNum > 1) { $page = $pageNum - 1; $prev = " [Prev] "; $first = " [First Page] "; } else { $prev = ' '; // we're on page one, don't print previous link $first = ' '; // nor the first page link } if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " [Next] "; $last = " [Last Page] "; } else { $next = ' '; // we're on the last page, don't print next link $last = ' '; // nor the last page link } // print the navigation link echo $first . $prev . $nav . $next . $last; // and close the database connection // include '../conn/closedb.php'; ?>