php - Fatal error Call to a member function insert() on a non-object -


i trying insert data using ajax in wordpress.but getting error below code in file have called using ajax:

global $wpdb;                      $wpdb->insert('design_information',                         array(                        'layout' => $_session['layout'],                        'language' => $_session['briefform_language'],                        'logo_name' => $_session['briefform_businessname_validation'] ,                       'org_description' => $_session['briefform_businesspurpose'],                        'bussiness_industry' => $_session['briefform_businessindustry'] ,                       'slogan_logo' => $_session['briefform_slogan'],                        'payment' => $_session['price'],                       'others' => $_session['briefform_comments'],                        'fullname' => $_post['paymentform_contactdetails_fullname'] ,                       'company_name' => $_post['paymentform_contactdetails_companyname'],                        'coutry_code' => $_post['paymentform_contactdetails_phonecountry'] ,                       'payment_status' => 'pending',                       'color_picker' => $newvalue1,                       'phone_no' => $_post['paymentform_contactdetails_phonenumber'],                                'address1' => $_post['paymentform_billingdetails_address1'] ,                        'address2' => $_post['paymentform_billingdetails_address2'] ,                       'city' => $_post['paymentform_billingdetails_city'],                       'zip' => $_post['paymentform_billingdetails_zip'],                       'state' => $_post['paymentform_billingdetails_state'],                                'country' => $_post['paymentform_billingdetails_country'],                               'design' => $newvalue,                                'slider' => $slider_value,                                'website address' => $_session['website address'],                                'style' => $_session['style'],                                'like' => $_session['like'],                               'file' => $_session['file'],                                'email' => $_session['email'],                                 'order_status' => "pending"                ));    

um, it's weird, maybe php thinks variable hasn't been declared or not instance:

try this:

include_once('wp-includes/wp-db.php');  global $wpdb; $wpdb->insert('design_information',  ... 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -