Using $wpdb generates DB error

its a syntax error according to error message. starements like below might work for you. global $wpdb; $wpdb->show_errors(); $tableCustom = ‘join_users_defis’; $sql = “SELECT * FROM {$wpdb->postmeta}”; $requeteAffichage = $wpdb->get_row( $sql ); //or $requeteAffichage = $wpdb->get_results( $sql ); var_dump($requeteAffichage);

$wpdb->get_var not returning a result

$wpdb->get_var returns a single variable, but your SQL statement has SELECT * which returns a row of multiple columns. You need to change your SQL statement to SELECT ID … instead of SELECT * …

How to Get All Taxonomies AND All Terms For Each Taxonomy With Post Count Zero

You can do this with just get_terms – this allows you to fetch all (or some) of the terms from one (or more) taxonomies. By default it excludes ’empty’ terms, so you’ll need to set the arguments appropriately. //Array of taxonomies to get terms for $taxonomies = array(‘category’,’post_tags’,’my-tax’); //Set arguments – don’t ‘hide’ empty terms. … Read more

Is there a (better) way to access $wpdb results?

This answer explains what the OP saw with column names and how to work with that, but the real answer is to use get_var() as in Howdy_McGee’s answer. The string you’re seeing is the column name that MySQL is using for the result, because it doesn’t have any better ideas. One way is to give … Read more

wpdb-> not adding prefix to custom table

$wpdb->tablename works only with the tables initially present in a WordPress installation. These tables are defined in wp-includes/wp-db.php. The second method you used is perfectly acceptable.

$wpdb->query() multiple query support

Using PHP 5.3.5, I was unable to make this syntax work even after setting the 5th parameter of mysql_connect() to 65536 (CLIENT_MULTI_STATEMENTS). Looks like it’s not possible to concatenate multiple queries into one statement as long as the old-school MySQL API is running the show. I assume you’re familiar with the MySQL multiple row INSERT … Read more

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