The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress Custom Form Error

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #40148

    I’m writing a plugin that posts data to the WordPress database.

    For the most part I have the basics working. I’m using this to check for duplicate entries.

    $duplicate =  $wpdb->get_results("SELECT * FROM wp_flr_locations WHERE location_name = '{$location_name}'");
    if (isset($_POST)) {
    if ($duplicate != '') {
    $wpdb->insert( 'wp_flr_locations', array( 'location_name' => $_POST ) );
    } else {
    No Duplaicates Allowed

    This does prevent duplicate entries from being posted to the database. The problem I'm having is I want an error message to show if it is duplicate. The "else" doesn't seem to work.

    Any Ideas?


    Thanks I’ll give it a try.
    I’m not a php expert either if you couldn’t tell.:)

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.