Jump to content

Search the Community

Showing results for tags 'delete'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 10 results

  1. gally06

    Delete All Messages Button

    Hey guys just wandered if you can help me on my website in the mailbox section next to the message there is a delete button to obviously delete that current message. However as I am sure you can appreciate it get tedious when you have 20 messages to do them all at once. So I am after putting a button at the top of this column in the table that will delete all the messages in there with one click. Below is the coding of where all this takes place: function mailbox($mes,$page) { global $config; if(!$page) { $page="1"; } $page=($page - 1); $totalmes=mysql_query("SELECT COUNT(*) FROM messages WHERE toid='".$_SESSION['tid']."' AND rcvddel=0"); $totalmes=mysql_result($totalmes,0); $out[body].=" <div style='float:left;width:69%;margin:5px;'> <table cellspacing='1' cellpadding='1' border='0' width='100%'> <tr> <td width='100%' class='blk_tcon' colspan='5'><b>" . LANG_MAI_MAILBOX . "</b></td> </tr> <tr> <td width='50%' colspan='2' class='blk_tcon_top'>" . LANG_MAI_SUBJECT . "</td> <td width='20%' class='blk_tcon_top'>" . LANG_MAI_FROM . "</td> <td width='25%' class='blk_tcon_top'>" . LANG_MAI_DATE . "</td> <td width='5%' class='blk_tcon_top'></td> </tr>"; $fmail=mysql_query("SELECT id,fromid,subject,active,sent FROM messages WHERE toid='".$_SESSION['tid']."' AND grid='1' AND rcvddel=0 ORDER BY sent DESC LIMIT $page, 15"); while(list($id,$fromid,$subject,$active,$sent)=mysql_fetch_row($fmail)) { $from=mysql_query("SELECT name FROM members WHERE id='$fromid'"); $from=mysql_fetch_array($from); if($fromid == '01') { $froma="Site Challenge"; }else{ $froma="<a href='./profile.php?account=$fromid'>$from[name]</a>"; } if($active == 1) { $icon="<img src='./images/unread.gif' border='0' alt='' />"; $title="<a href='./mailbox.php?action=readmail&mailtype=received&mid=$id'><b>$subject</b></a>"; }else if($active == 2){ $icon="<img src='./images/read.gif' border='0' alt='' />"; $title="<a href='./mailbox.php?action=readmail&mailtype=received&mid=$id'>$subject</a>"; }else{ $icon="<img src='./images/replied.gif' border='0' alt='' />"; $title="<a href='./mailbox.php?action=readmail&mailtype=received&mid=$id'>$subject</a>"; } $out[body].=" <tr> <td width='5%' align='center' class='blk_tcon'>$icon</td> <td width='45%' align='left' class='blk_tcon'>$title</td> <td width='20%' align='center' class='blk_tcon'>$froma</td> <td width='25%' align='center' class='blk_tcon'>$sent</td> <td width='5%' align='center' class='blk_tcon'> <form method='post'> <input type='hidden' name='mail[id]' value='$id' /> <input type='hidden' name='mail[mailtype]' value='received' /> <input type='hidden' name='action' value='delete' /> <input type='submit' class='button' name='submit' value='X' style='color:red; font-weight:bold;' title='" . LANG_MAI_DELETE . "' /> </form> </td> </tr>"; } if($totalmes == 0) { $out[body].=" <tr> <td width='100%' align='center' colspan='5' class='blk_tcon'>" . LANG_MAI_MAILBOX_EMPTY . "</td> </tr>"; } $pagenow=($page + 1); $pages=1; if($pagenow==1) { $skipranks.="[$pages] "; }else{ $skipranks.="<a href='./mailbox.php?page=1'>$pages</a> "; } $arank=1; $brank=15; while($brank < $totalmes) { $arank=($arank + 15); $brank=($brank + 15); $pages++; if($pagenow==$arank) { $skipranks.="[$pages] "; }else{ $skipranks.="<a href='./mailbox.php?page=$arank'>$pages</a> "; } } $out[body].=" <tr> <td width='100%' align='center' class='blk_tcon' colspan='5'>$skipranks</td> </tr> </table> </div> ".TOP_MENU.""; include("$config[html]"); } </tr>"; That is the whole coding of the mailbox received section, as you can see the messages section is all done in form coding so can i pop a nice button at the top to delete all or does it have to be check boxes and stuff. For help with the view of this I have attached a screenshot Thanks for any help in advance.
  2. Ok this is puzzleing. I am geting "Could not delete data: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1". but its is deleting the entry that needs to be removed. The "1" is the entry. Just not sure what is causing the error. I do have another delete php but I have put that on the back burning for the time being. <?php $con = mysqli_connect("localhost","user","password","part_inventory"); // Check connection if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } else { $result = mysqli_query($con, "SELECT * FROM amp20 "); $amp20ptid = $_POST['amp20ptid']; // escape variables for security $amp20ptid = mysqli_real_escape_string($con, $_POST['amp20ptid']); mysqli_query($con, "DELETE FROM amp20 WHERE amp20ptid = '$amp20ptid'"); if (!mysqli_query($con, $amp20ptid)); { die('Could not delete data: ' . mysqli_error($con)); } echo "Part has been deleted to the database!!!\n"; mysqli_close($con); } ?>
  3. machta

    delete image from folder

    Hello I am new here, and so i am to php.. i have a small question - i think anyone here could help me, im sure :-) I have a php-gallery running locally on my desktop (using xampp), the gallery just shows images from a directory where a webcam saves its pictures in it (the gallery is named "ubergallery" - maybe anyone knows this gallery). Now i really would like to have following option: - A Button on the thumbnail called "delete" - when clicking on it, the picture should get replaced with another, predefined, placeholder-picture. I really hope somebody here can help me ! Thank you so much for your time ! I have attached the files! UberGallery.php index.php index.php
  4. I have a simple user login where it inserts the user session into database like this (id, user_id, hash). It works fine. I can delete the session from the database when the user logs out. Now I realized something. When I close the browser window, it'll destroy the session(log out the user) as intended but it won't delete the session from the database. I was wondering if there is a way to do that?
  5. I have 2 issues happening, first one I need to get resolved is, line 60 is giving me a 'Notice: Undefined variable: delete'. This codes had multi issues but was able to resolve all but this one and my table not filling in with the data from my database. If you need any other info please let me know, Again I am new at this. <tr> <td colspan="5" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit" id="delete value="delete"></td> </tr> <?php // Check if delete button active, start this *line 60* -----> if ($delete){ for($i=0;$i<$count;$i++){ $del_id = $checkbox[$i]; $sql = "DELETE FROM $tbl_name WHERE id='$del_id'"; $result = mysqli_query($sql); } // if successful redirect to delete_multiple.php if($result){ echo "<meta http-equiv=\"refresh\" content=\"0;URL=delete_multiple.php\">"; } } mysqli_close($con); ?>
  6. The code in attached file is not working for me. and i am failed to find any mistake. Anyone help me please. deletedept.php
  7. sigmahokies

    Delete data in SQL in PHP

    Hi everyone, I don't understand why MySQL won't do execute query to delete record in phpmyadmin. I made a script in PHP, what did I do wrong? First page: <?php session_start(); if ($_SESSION['user']) { echo "<p>You are logging in as ".$_SESSION['user']." <a href='logout.php'>Log out</a></p>"; } else { header('location:denied.php'); } require('require.php'); ?> <!doctype html> <html> <head> <title>Delete your member's information</title> <link href="rcd.css" rel="stylesheet" type="text/css"> <link href="submit.css" rel="stylesheet" type="text/css"> </head> <body> <center> <p>Are you sure you want to delete this member's information?</p> <form action="delete2.php"> <table> <?php $del = $_GET['delete']; $show = "SELECT * FROM Members WHERE ID = '".$del."'"; $result = mysqli_query($Garydb, $show); if (mysqli_num_rows($result)) { while ($rows = mysqli_fetch_assoc($result)) { echo "<tr><td>First Name: </td><td><input type='text' value='".$rows['FirstName']."'></td></tr>"; echo "<tr><td>Last Name: </td><td><input type='text' value='".$rows['LastName']."'></td></tr>"; echo "<tr><td>Birth Month: </td><td><input type='text' value='".$rows['Month']."'></td></tr>"; echo "<tr><td>Email: </td><td><input type='text' value='".$rows['Email']."'></td></tr>"; echo "<tr><td>Local: </td><td><input type='text' value='".$rows['Local']."'></td></tr>"; echo "<tr><td colspan='2'><a href='delete2.php?delete2=".$rows['ID']."' style='font-size:20px;'>Delete Member's Information</a></td></tr>"; } } ?> </table> </form> <p><a href="register.php">Return to register page</a></p> </center> </body> </html> Second Page <?php session_start(); if ($_SESSION['user']) { echo $_SESSION['user']; }else { header('denied.php'); } require("require.php"); if ($_GET['delete2']) { $delete = $_GET['delete2']; } if ($delete) { $del = "DELETE * FROM Members WHERE ID = '".$delete."'"; mysqli_query($Garydb, $del); } ?> <!doctype html> <html> <head> <title>Deleted</title> </head> </html>
  8. I currently have a php code at the top of the page that would automatically delete a user from the database if a certain condition isn't met before 24 hours. This code is processed no matter where you are on the site. I have two questions. 1. Will this be an issue if the database has thousands of users? 2. Is there a better way to do this?
  9. Hi Guys, I have a form where the user can select rows and delete them. But my problem is when I select around 4800 rows to delete it takes too long and also only 2500 rows get deleted. So, could someone help me with the below code so it does not take more time and also deletes all the rows? Note: 1. I use InnoDB 2. I use ajax with async set to false <?php include("dbconnect.php"); ini_set ( 'max_execution_time', 20000); if(isset($_POST['id'])){ foreach ($_POST['id'] as $ids) { $stmt = $dbconnect->prepare("DELETE FROM datatable WHERE id=:id"); $stmt -> bindValue(':id', $ids); $stmt -> execute(); } $data =1; echo $data; } ?> I see in the above code my delete query is executed again and again through the loop and I would like to know if there is a way to execute only one statement and get all the ids inside the statement. Thank you.
  10. Hello PHP Freaks, I think this is just if else statement problem but im kinda lose to it. The whole code is succesful in deleting the data from database the problem is i wanted to put a script that remind the user if he/she really sure to delete the data. By the way this is the script. <?php // connect to the database include 'Connect.php'; // confirm that the 'student_id' variable has been set if (isset($_GET['student_id']) && is_numeric($_GET['student_id'])) { // get the 'student_id' variable from the URL $student_id = $_GET['student_id']; // delete record from database if ($stmt = $mysql->prepare("DELETE FROM student_information WHERE student_id = ? LIMIT 1")) { $stmt->bind_param("i",$student_id); $stmt->execute(); $stmt->close(); } else { echo "ERROR: could not prepare SQL statement."; } $mysql->close(); // redirect user after delete is successful header("Location: Admin_Home.php"); } else // if the 'student_id' variable isn't set, redirect the user { header("Location: Admin_Home.php"); } ?> Please help me modify these codes and where to put the missing line/s of codes.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.