About wp database hooks (error establishing connection)
Fixed, done a little bit different implementation of the problem fix, without hooks. TC.
Fixed, done a little bit different implementation of the problem fix, without hooks. TC.
How to return count of items found in SQL query
Rewrite SQL query as a prepared statement and use in foreach loop
I figured it out myself I needed $wpdb and a , after the db_name Here is the result. $user_id = $wpdb->INSERT( ‘wp_fisker’, array ( ‘fisker_fornavn’ => apply_filters(‘pre_user_first_name’, $fisker_fornavn), ‘fisker_efternavn’ => apply_filters(‘pre_user_last_name’, $fisker_efternavn), ‘password’ => apply_filters(‘pre_user_user_pass’, $password), ‘telefon’ => apply_filters(‘pre_user_telefon’, $telefon), ‘zip’ => apply_filters(‘pre_user_zip’, $zip), ‘by_navn’ => apply_filters(‘pre_user_by_navn’, $by_navn), ’email’ => apply_filters(‘pre_user_user_email’, $email) ) ); if( … Read more
Correct and secure way to access a custom SQL database in a custom PHP template file
Intermittent problem writing update_user_meta
From quick look through the source it doesn’t seem like wpdb actively implements any handling for warnings (as opposed to errors). Proactively you can just ask for them as a custom query ($wpdb->get_results( ‘SHOW WARNINGS;’ ) I suppose, but implicitly they just aren’t tracked by WP core.
There’s a lot wrong with your code: In your query you’re setting reg_user_id to $user, when it looks like you meant to use $reg_user_id, which is probably a problem because you’re setting $user to $current_user->ID even though $current_user doesn’t exist. $_POST[‘reg_id’] doesn’t exist in your form, and I have no idea what you’re trying to … Read more
You haven’t mentioned what you want from this request and what is it for. You should clarify that to get the most accurate answer. Anyway, if you want to write a pure SQL request you can’t use WP_Query but need to use $wpdb->get_results instead, as mentionned by @hadimahoor. Here is a request to get a … Read more
You should use the default way the WP recommend to handle ajax calls. This will save you from lots of pitfalls and bad practices. add_action( ‘wp_ajax_nopriv_****’, ‘your_custom_function’ ); add_action( ‘wp_ajax_****’, ‘your_custom_function’ ); function your_custom_function() { } JS part jQuery.ajax({ type: “post”, dataType: “json”, url: ajax_url,// need the admin_url(‘admin-ajax.php’) data: formData, // your data success: function(msg){ … Read more