php - Wordpress $wpdb->query() inserts multiple rows with duplicate data -
i experiencing strange problem wordpress query() function.
i have form on page 1 below code insert new record.
if(isset($_post["transaction_id"])){ global $wpdb; $sql = $wpdb->prepare( " insert `{$wpdb->prefix}v_cards` (transaction_id, user_id) values ( %d, %d)", $_post['transaction_id'], $_post['user_id']); $wpdb->query($sql); $_session['card_id'] = $wpdb->insert_id; } , on submit below update query fires update row $sql = $wpdb->prepare('update '.$wpdb->prefix.'v_cards set prefix=%s, first_name=%s, middle_name=%s, last_name=%s, suffix=%s, degree=%s, description=%s, copyright=%s, background=%s, photo=%s, call_country_code=%s, call_number=%s, call_ext=%s, call_activate=%s, text_country_code=%s, text_number=%s, text_ext=%s, text_activate=%s, email=%s, email_activate=%s, find_location_name=%s, find_address_1=%s, find_address_2=%s, find_city=%s, find_state=%s, find_postcode=%s, find_country_code=%s, find_activate=%s, profile_details=%s, profile_activate=%s, organization=%s, org_industry=%s, org_country=%s, org_address_1=%s, org_address_2=%s, org_city=%s, org_state=%s, org_postcode=%s, org_phone=%s, org_fax=%s, org_email=%s, org_details=%s, org_activate=%s, contact_location_name=%s, contact_country=%s, contact_address_1=%s, contact_address_2=%s, contact_city=%s, contact_state=%s, contact_postcode=%s, contact_phone=%s, contact_fax=%s, contact_email=%s, contact_activate=%s, my_sites_title=%s, my_sites_url=%s, my_sites_activate=%s, social_title=%s, social_url=%s, social_activate=%s, icon=%s, card_name=%s, card_status=%s, modify_date=sysdate() id = %s', $_post['prefix'], $_post['first_name'], $_post['middle_name'], $_post['last_name'], $_post['suffix'], $_post['degree'], $_post['description'], $_post['copyright'], $background_id, $icon_id, $_post['call_country_code'], $_post['call_number'], $_post['call_ext'], $_post['call_activate'], $_post['text_country_code'], $_post['text_number'], $_post['text_ext'], $_post['text_activate'], $_post['email'], $_post['email_activate'], $_post['find_location_name'], $_post['find_address_1'], $_post['find_address_2'], $_post['find_city'], $_post['find_state'], $_post['find_postcode'], $_post['find_country_code'], $_post['find_activate'], $_post['profile_details'], $_post['profile_activate'], $_post['organization'], $_post['org_industry'], $_post['org_country'], $_post['org_address_1'], $_post['org_address_2'], $_post['org_city'], $_post['org_state'], $_post['org_postcode'], $_post['org_phone'], $_post['org_fax'], $_post['org_email'], $_post['org_details'], $_post['org_activate'], $_post['contact_location_name'], $_post['country_contact'], $_post['contact_address_1'], $_post['contact_address_2'], $_post['contact_city'], $_post['contact_state'], $_post['contact_postcode'], $_post['contact_phone'], $_post['contact_fax'], $_post['contact_email'], $_post['contact_activate'], $_post['my_sites_title'], $_post['my_sites_url'], $_post['my_sites_activate'], $_post['social_title'], $_post['social_url'], $_post['social_activate'], $icon_id, $_post['card_name'], $_post['card_status'], $_session['card_id']); $wpdb->query($sql);
but instead when submit form , insert new row , updates old row code written in wordpress widget (second top widgets area).
thanks in advance
try disable xdebug if it's activated. same bug happened me while xdebug active.
Comments
Post a Comment