Support » Plugin: Contact Form DB » Delete or modify entry in PHP

  • Hi, nice plugin. It works really good and does what I need. I have a problem. I want to create a short-code where it can delete an entry or modify an entry in the table with the user entered information. I don’t have the information of the mysql (username, password, etc.), and neither I want to ask for it. For now this is in my short code:

    require_once(ABSPATH . ‘wp-content/plugins/contact-form-7-to-database-extension/CFDBFormIterator.php’);
    $exp = new CFDBFormIterator();
    $exp->export($atts[‘form’], $atts);
    $unit = $_POST[“fname”];

    $formName = $atts[‘form’];
    $userId = $atts[‘userId’];
    $unit = $atts[‘unit’];
    global $wpdb;
    $wpdb->query(“DELETE from wp_cf7dbplugin_submits
    WHERE (field_name = ‘menu-726’
    AND field_value = ‘%s’) AND
    (field_name = ‘user-id’
    AND field_value = ‘%s’)
    AND form_name = ‘%s'”,$unit,$userId,$formName);

    Sorry for my lack of PHP and MySQL, data bases is not my strong part of computer science.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Michael Simpson


    Editing and deleting is tricky and I don’t really want to support people doing it because inevitably stuff will get messed up in the DB and people will want even more of my time to sort that out and I just don’t have the time to do it. No offense.

    It is ok, and I understand you. But I need to at least create it because I want people to update some entries. When the entry is update I want to remove the old information. If isn’t possible to delete or remove, then, can I just show the latest entries in the table where the username is different?

    Thanks for your reply.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Delete or modify entry in PHP’ is closed to new replies.