How much does $wpdb->prepare(), then $wpdb->query() VS straight $wpdb->query(), can slow down the load time of whole page

$wpdb->prepare shouldn’t make any significant difference. As you can see here (https://developer.wordpress.org/reference/classes/wpdb/prepare/#source), it doesn’t do much. It’s just taking care of proper escaping and formatting variables, so the final query is safe to run. So if you’re asking if there is a big difference between $wpdb->query( $wpdb->prepare( … ) ) and $wpdb->query( <SAFE_SQL> ), then … Read more

selecting row using wpdb which contain special symbols

You can try the following query SELECT * FROM `mytable` WHERE `question` = ‘\\\”creating world \\\” written by\?’ In php global $wpdb; $quest=addcslashes(‘\”creating world \” written by?’,’\”?’); $result = $wpdb->get_results(“SELECT * FROM mytable WHERE question ='{$quest}'”);

Ajax Query returns zero

if ajax returns zero, the function bound is not registered properly have a read: http://arresteddeveloper.net/woocommerce-get-variation-description-variation-select-changes/ this might point you in the right direction

$wpdb->prepare returns empty array

Try with: function getComponents($page_id, $currentLanguage) { global $wpdb; $result = $wpdb->get_results($wpdb->prepare( ” SELECT id, post_content, post_title, post_excerpt, post_name, m1.meta_value AS ‘template’, m2.meta_value AS ‘home_description’ FROM {$wpdb->posts} p JOIN wp_term_relationships r ON p.ID = r.object_id JOIN wp_terms t ON r.term_taxonomy_id = t.term_id WHERE t.slug=%s AND post_parent = %d AND post_type=”page” AND post_status=”publish” ORDER BY menu_order ASC … Read more

wpdb LIKE request shows all database data

Can you verify that $_POST[‘name’] is obtaining a value. I suggest echoing it out to the page for debugging (maybe in comment tags if site is live). If $_POST[‘name’] is empty, then all results will be returned because the query will say user_nicename LIKE ‘%’ Just as a precaution in any case, you should do … Read more

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