• Hi,
    I use this code to insert some data in the database but the problem is that the row is saved two times, but I want only one tine..

    $data_array = array('aff_id' => $aff_id, 'remote_addr' => $remoteaddress, 'url' => $curentpage, 'referrer' => $httpreferer);
    	$wpdb->insert( 'amember_aff_clicks', $data_array );

    Please Help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Alexandru Vornicescu

    (@alexvorn2)

    any help?

    don’t keep any value as null. here if any of value is null then it will give this error. so check all of the variable for null and if so assign blank string for that. you can check like this.

    if (!isset($aff_id)) {
        $aff_id = "";
    }

    do this for all value on input array then it will work.

    and you can see more at sugunan.com

    The null value check can be done easily like this

    foreach ($data_array as $key=>$val) {
       if (!isset($data_array[$key])) {
          $data_array[$key] = "";
       }
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘$wpdb->insert, dublicate inserts’ is closed to new replies.