MySql Query For WordPress

I want to edit a WordPress plugin. My code is below. The parts in which I’m stuck is documented in the code. Could you show me the correct way to write the code please?

Thanks.

<?php
global $wpdb; //I think this is correct
//I need help to convert the 2 lines below to a WordPress friendly query
$query1="SELECT * FROM wp_users WHERE user_login LIKE '%z%'"; 
$result1 = mysql_query($query1);
//I want to put the search results into the example below
if ( $user_login == 'admin' || $user_login == 'joe' ) {
$do_something;
}
?>


Source: wordpress

Leave a Reply