Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to run a SELECT query on the Wordpress database and get the results on the screen. Any widget which does it?

share|improve this question

2 Answers 2

Have a look at the $wpdb class, it does exactly what you want:

$myrows = $wpdb->get_results( "SELECT id, name FROM mytable" );

Try to avoid SQL queries for basic operations though. WordPress offers you many convenience functions for 80% of the tasks you would every come up with. They provide a nicer interface and preserve upwards compatibility. For example to get posts from the DB you could use the WP_Query class or the get_posts() function.

share|improve this answer
    
Hello and thanks for your reply. I do not have access to php files right now. I would prefere to do this via a widget. Any widget that offers this? –  p.a. Sep 3 '12 at 11:56

I did what I wanted with phpMyAdmin. Thanks.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.