WordPress(wpdb class) and mysql stored procedures

wpdb detects the type of query and returns the result if it starts with select, else the affected rows. Since yours starts by call, it’s probably mistaking it for an insert, update, delete, etc. statement. Try this (might trick wpdb into thinking it’s a select statement: /* select */ call …; Or this (not sure … Read more

Ajax future single post query doesn’t work when NOT logged in

usually it because you are missing an “add_action” call for none logged in users. add this to your plugin or functions.php add_action(‘wp_ajax_nopriv_REPLACETHIS’, ‘ajax_get_date_post’); and change the REPLACETHIS to your action value from the ajax call. remember that when calling ajax from front-end and you want to allow none logged in users to make these calls … Read more

Use mysql_query instead of $wpdb query

Simple and short: mysql_query() = Faster! $wpdb->get_results() = Safer! But in most cases since $wpdb is a global object and already in the memory using it will be be as fast as mysql_query(). Will this affect my performance? It can affect for better performance changes but they would be minor changes that its just not … Read more

wordpress $wpdb works only once

Don’t bother using wpdb to update post content, use wp_update_post instead! http://codex.wordpress.org/Function_Reference/wp_update_post Instead of $wpdb->update($seo_tblPosts, array(‘post_content’=>$seo_pageContents), array(‘ID’=>$row_id)); Do: // Update post 37 $my_post = array(); $my_post[‘ID’] = $row_id; $my_post[‘post_content’] = $seo_pageContents; // Update the post into the database wp_update_post( $my_post ); As a side benefit it fires all the hooks so caching works as it … Read more

Why does this WPDB code throw an empty WPDB error? [closed]

The code you’ve linked to above: //$sql set to raw SQL statement $sql = $wpdb->prepare($sql,$feed_id); if($wpdb->query($sql)){ $resp->uf_error = $wpdb->print_error(); } So if there isn’t, an error you try displaying the ‘error’ with $wpdb->print_error(). Also$wpdb->print_error() doesn’t return an error, it prints it. It’s (probably) the printing of that non-error that is causing an error in your … Read more

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