php - How do I write this with mysqli? -
trying convert mysql mysqli. got comfortable using queries, i'm not sure need now. here what's going on:
access "wp_users" table (wouldn't surprised if wrote wrong):
mysqli_query($conn, "select * `value` `wp_users` 1"); while ($row = mysqli_fetch_assoc($query)) { $result_wp_users = $row[value]; }
can't find users:
if ( !$result_wp_users) { die('</br> cannot find users:' . mysqli_error($conn)); }
i need information (but using mysqli):
$display_name = mysql_result($result_wp_users, $i, 'display_name'); echo $display_name;
i've tried writing few different ways mysqli, can't work. help?
also, have resource getting comfortable mysqli? api giving me more confusion @ point (i'm extremely new this). need explained me i'm 5 years old.
it looks using wordpress. can use wp_user_query class query users.
don't add arguments wp_user_query users.
$user_query = new wp_user_query(); // user loop if ( ! empty( $user_query->results ) ) { foreach ( $user_query->results $user ) { echo '<p>' . $user->display_name . '</p>'; } } else { echo 'no users found.'; }
or mysqli:
mysqli_query($conn, "select * wp_users 1 = 1");
Comments
Post a Comment