wordpress insert and update query not working -
i trying insert , update data not seems work in wordpress . database exist , when try insert manually works .
global $wpdb; $db=$wpdb->prefix.'arete_woocommerce_sms_panel_settings'; $data = $wpdb->get_results ("select * {$db}"); if (!empty( $data )) { $wpdb->update("{$db}",array('type'=>"sms_provider_url",'value'=>$sms_provider_url),array('%s','%s')); $wpdb->update("{$db}",array('type'=>"sms_provider_username_with_param",'value'=>$username),array('%s','%s')); $wpdb->update("{$db}",array('type'=>"sms_provider_password_with_param",'value'=>$password),array('%s','%s')); $wpdb->update("{$db}",array('type'=>"sms_provider_key_with_param",'value'=>$sms_api_key_with_parameter),array('%s','%s')); $wpdb->update("{$db}",array('type'=>"sms_provider_sender_id_with_param",'value'=>$sms_api_sender_id_with_parameter),array('%s','%s')); $wpdb->update("{$db}",array('type'=>"sms_provider_custom_with_param",'value'=>$sms_custom_values_with_parameter),array('%s','%s')); } else { $wpdb->insert("{$db}",array('type'=>"sms_provider_url",'value'=>$sms_provider_url),array('%s','%s')); $wpdb->insert("{$db}",array('type'=>"sms_provider_username_with_param",'value'=>$username),array('%s','%s')); $wpdb->insert("{$db}",array('type'=>"sms_provider_password_with_param",'value'=>$password),array('%s','%s')); $wpdb->insert("{$db}",array('type'=>"sms_provider_key_with_param",'value'=>$sms_api_key_with_parameter),array('%s','%s')); $wpdb->insert("{$db}",array('type'=>"sms_provider_sender_id_with_param",'value'=>$sms_api_sender_id_with_parameter),array('%s','%s')); $wpdb->insert("{$db}",array('type'=>"sms_provider_custom_with_param",'value'=>$sms_custom_values_with_parameter),array('%s','%s')); }
Comments
Post a Comment