MySQL query in WordPress with AJAX

I would need to see your trigger function but it sounds like you just need to add event.preventdefault to the submit. This will block the page load while still executing AJAX. $(“form.searchCV_form”).submit(function(event){ event.preventDefault(); alert( “We’re not going anywhere now…” ); // j$.post… }); or $(“form.searchCV_form”).submit(function(e){ alert( “We’re not going anywhere now…” ); // j$.post… return … Read more

wpdb get_row database query inquiry

For Placehold to work, you should use $wpdb->query like: $wpdb->query( $wpdb->prepare( ” SELECT * FROM mailer WHERE id = %d “, $_GET[‘caId’] ) ); However in my opinion, the best option is to simply validate the get-parameter and than use it in $wpdb->get_results , like: $catId = $_GET[‘caId’]; if(is_numeric($catId)){ $_crds = $wpdb->get_results(” SELECT * FROM … Read more

I have include wp-config, should I add global $wpdb also?

If you need a processing endpoint with access to the WordPress API, use the admin_post_ action and eliminate the need to manually include wp-config.php or any other WordPress files. // add for logged-in visitors add_action( ‘admin_post_your_action’, ‘prefix_your_action_function’ ); // for non logged-in visitors add_action( ‘admin_post_nopriv_your_action’, ‘prefix_your_action_function’ ); function prefix_your_action_function() { global $wpdb; // your processing … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)