Sql query returns empty. But not

If you can answer ‘yes’ to the questions in Emetrop’s comment, then try: $sql = $wpdb->get_results(‘SELECT * from table1 WHERE id = $bransId’);

Can I use mysql queries to replace query_posts()?

It’s not clear what do you mean by template “accepting” variables. WP_Query (which query_posts()/get_posts() are build on top of) is very flexible. In many cases it’s not as much being able to do something with it, as having experience using it to achieve results. Typically even when queries cannot be expressed in single set of … Read more

Check if a database is well installed

Some things to check: Have you update the site URL in the wp_options table? Once you log-in to wp-admin change the permalink structure and click save – this makes the system refresh all the links. I personally always use MySQL Workbench to Export and Import data for MySQL databases as it makes life much easier.

Custom metabox does not store data

Are you sure it isn’t saving the values to the DB? Perhaps it’s just not displaying the previously saved values in your form? $values = get_post_custom( $post->ID ); This is what you are using to get your meta – but this returns a multi-dimensional array. Therefore when accessing your beef_meta_box_price value, you need to use … Read more

MySQL Select within WP Page template

@Adrian, You don’t really need to assign anything to variables. You already have the information, you just need to loop through it and add the required HTML as you wish. If you actually want to use a table you can do something similar to: <table> <?php $myrows = $wpdb->get_results( “SELECT first_name, surname FROM members” ); … Read more