Using WordPress Database Class to access data

WordPress exposes an instance of a class named $wpdb that lets you access any table within your blog database. The following example gets a row from the users table and print the result as an associative array.

$user_info = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE id = 1", 'ARRAY_A');

Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

IMPORTANT! To be able to proceed, you need to solve the following simple math (so I know that you are a human) :-)

What is 15 + 4 ?
Please leave these two fields as-is: