WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form DB
Delete or modify entry in PHP (3 posts)

  1. axelyamel
    Member
    Posted 1 year ago #

    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.

    http://wordpress.org/extend/plugins/contact-form-7-to-database-extension/

  2. Michael Simpson
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. axelyamel
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic