kirtan007 Posted August 28, 2009 Share Posted August 28, 2009 I have made Page that Delete record From MYSql Database. using like ManageProjects.php?deleteid=1 and it deletes Record with ID 1 but after deleting i want to refresh the same page and want to show user its deleted . How can i do this ? Link to comment https://forums.phpfreaks.com/topic/172228-need-help-regarding-to-refreshing-page/ Share on other sites More sharing options...
oni-kun Posted August 28, 2009 Share Posted August 28, 2009 Use the header() function to go to.. ManageProjects.php?deleteid=1&deleted=true. If delete=true is there, then it should display 'record 1 deleted' instead of deleting the record, very simple to do with IF's and GET's. You have to place: <?php ob_start(); //at top //your code.. if (isset($_GET['deleted'])) { echo "Record ".$_GET['deleteid']." has been deleted!" } else { //delete record header(bla..&deleted=true); } at the top of your page, right after the <?php to be able to header if that's what you like, since the output buffer would stop you otherwise and throw an error. Link to comment https://forums.phpfreaks.com/topic/172228-need-help-regarding-to-refreshing-page/#findComment-908064 Share on other sites More sharing options...
kirtan007 Posted August 28, 2009 Author Share Posted August 28, 2009 <?php include("Connection.php"); $result = mysql_query("Select * from projects",$con); $num = mysql_num_rows($result); $deleteid = $_REQUEST['deleteid']; if($deleteid != "") { $q = mysql_query("delete from Projects where ProjectID=" .$deleteid,$con); echo "Project Deleted !!"; header('Location:ManagerProjects.php'); } if ($num > 0) { echo "<table>"; echo "<th>Project ID</th><th>Project Name</th><th>Project Description</th>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td><center>" . $row['ProjectID'] . "<center></td>"; echo "<center><td>" . $row['ProjectName'] . "</td></center>"; echo "<center><td>" . $row['ProjectDesc'] . "</td></center>"; echo "<center><td>" . $row['ProjectImage'] . "</td></center>"; echo "<td><a href=ManageProjects.php?deleteid=" . $row['ProjectID'].">Delete</a></td>"; echo "</tr>"; } echo "</table>" ; } else { echo "No Record Found !!"; } ?> <a href="AddnewProjectForm.php">Add New Project</a> Hii Thanks for Reply Friend Here is My Code I Can delete the record from database but after deleting I have to manually Refresh the Page Link to comment https://forums.phpfreaks.com/topic/172228-need-help-regarding-to-refreshing-page/#findComment-908067 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.