Configuration guides for IT Administrators

wpdb last_query

  • showing errors with wpdb update or insert query

    showing errors with wpdb update or insert query

    exit(var_dump( $wpdb->last_query )) prints the last query that is executed by database. This is very useful for developers to verify and troubleshoot errors in your query syntax or data format. One sample is presented here for you. if ($wpdb->update(“laundry_item_master”, array( ‘dryclean_normal’ => $dryclean_normal, ‘dryclean_urgent’ => $dryclean_urgent, ‘washing_normal’ => $washing_normal, ‘washing_urgent’ => $washing_urgent, ‘pressing_normal’ => $pressing_normal, ‘pressing_urgent’ => $pressing_urgent,…

    Read More →: showing errors with wpdb update or insert query
  • wpdb last_query, last_result, last_error

    wpdb last_query, last_result, last_error

    There are times that you wanted to print the exact query itself or query result right after it is executed. Use following wpdb class variables to troubleshoot. $wpdb->last_query This prints that last query that is executed, I mean the exact MySQL Query itself. $laundrycustomer = $wpdb->get_row(“SELECT company_name, customer_name, phone, address FROM laundry_customers where phone = $searchphone;”);…

    Read More →: wpdb last_query, last_result, last_error

Lucas Brey

I’m Lucas Brey, a travel blogger sharing practical guides, hidden gems, and honest tips from the road. Follow along for smart itineraries, great food finds, and stories worth bookmarking.

Tags