Menu

Deleting records via admin portal

Help
augatti
2004-11-11
2013-06-03
  • augatti

    augatti - 2004-11-11

    Firstly, I have just started using phpFormGenerator and it has been tremendously helpful. But I do have one problem I can't get my head around.

    I chose the mySql database option and let phpFormGenerator create the table. The form successfully writes records to it. I am however having a problem getting the Delete on the Admin Portal to work. The delete query appears to execute okay, but on refresh the record is still there. I have not edited the files in the /use/???/admin directory.

    Could this be a permission problem. I am however, able to delete records in the table via a phpMyAdmin interface.

    Any assistance would be greatly appreciated.

     
    • Steve Blandford

      Steve Blandford - 2004-12-09

      I've just struggled with this same issue and this is what I did to resolve it.

      All the changes were in the delete_rec.php page

      1. change the pt_register('POST','id');
          to pt_register('GET','id');

      2. I changed the query to
           $query = ("delete from $table where id=$id limit 1");

      The two important things to notice in the query are that there is now one '=' sign instead of two '=='.
      PHP might like two equal signs for testing equivalance but SQL gags on it.

      I added the 'limit 1' to the end of the query as a safety measure. in that way a malicious user cannot delete more than one record per submission.

      I hope this helps.

       
      • augatti

        augatti - 2004-12-09

        Woohoo - that solved my problem! Thank you very very much Steve.

         
        • Jordan

          Jordan - 2007-07-06

          I had the same problem. I have two instances of forms running on separate servers (purchased separately from Lunarpages and Hostgator). The code in del_rec.php removed the record as expected with MySQL on hostgator, but it did not work on Lunarpages until I changed it to what Steve suggested. Thank you and thanks for creating this very useful tool!

           
      • DevonTT

        DevonTT - 2007-10-04

        So simple!  Thanks.  I had the same problem three years after you answered this question!

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.