Depreciated Call -> Function wpdb::escape()

prepare works a bit differently than escape in that it works on whole strings and manages quoting as well. $pat = “UPDATE {$wpdb->posts} SET %s = %s WHERE ID = %d”; $qry = $wpdb->prepare( $pat, $key, $visibility, $post_id ); $wpdb->query($qry); You do not need to swap in the table name at all, and with prepare … Read more

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