What argument does my function need to echo get_results() query results

Why don’t you just do.. add_action( ‘wp_head’, ‘quick_qs_db_css’, 100 ); function quick_qs_db_css() { ?> global $wpdb; $table_name = $wpdb->prefix . ‘qs_css’; $db_css = $wpdb->get_results( ” SELECT qs_the_css FROM $table_name WHERE qs_css_id = 1 ” ); <style type=”text/css” id=”db-css”> <?php echo $db_css[0]->qs_the_css; //outputs null ?> </style> <?php } Seeing as you are using it everytime head … Read more

SQL Query Search page

you can use WP_Query(); to query the results. it has an argument ‘s’ => $search_query, create an input, get the input value, store it in $search_query, then create a query, $query = new WP_Query( array( ‘post_type’ => ‘post’, ‘s’ => $search_query ) ); if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); // … Read more

$wpdb post type and term query only works when there are no dashes or spaces in the term slug and title

In your code you are using “AND terms.name=”shorelineorwaterway” where I don’t think shorelineorwaterway is your term name, it could be your terms slug. So you can modify this by “AND terms.slug = ‘shorelineorwaterway’ and here inside inverted commas you can use hyphen. If you need to use term name then “AND terms.name=”Your Term Name” would … Read more

Are there any best practices for creating a Like/Favourite feature in WordPress using custom MySQL tables and without any plugins?

Using WordPress’s wp_postmeta will help you a lot, instead of creating a new table. Functions like get_post_meta(), update_post_meta(), add_post_meta() etc, are readily available for use. All you need is to create a meta_key (which in this case will be wp_likes) and the meta_value (number of likes will be stored), which can be easily retrieved using … Read more

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