php - Another beginner with a mysqli issue -


i'm quite new working php , databases. so, beginners, i'm having problems mysqli extension. trying avoid using mysqli_results, didn't want deal array , loop every time want simple piece of data. might not possible.

i need echo $user_count, nothing seems stored there. code seems okay according api, maybe i'm trying use wrong functions altogether. how put result need $user_name?

mysqli_query($conn, "select * `wp_users` 1"); $result_user_count = mysqli_query($conn, "select count(`id`) `wp_users`"); $user_count = mysqli_fetch_field_direct($result_user_count, 0); echo $user_count . ' users found on ' . $dbname . ':</br>'; 

based on provided code, need change below:-

$query = mysqli_query($conn, "select count(id) count wp_users") or die(mysqli_error($conn));  while ($row = mysqli_fetch_assoc($query)) {         echo "total users are:- ". $row["count"]; } 

note:- try add mysqli error reporting code problem exist in query code, , can resolve them. thanks


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -