hi i have a little problem, that i want to print the count of id, so i write this:

$conn=mysqli_connect("localhost", "root", "","test") or die(mysqli_error());
$compt=mysqli_query($conn,"SELECT count(id) FROM `users`", MYSQLI_USE_RESULT);
print $compt;

to connect to db and extract the count id, i have an error and i dont know how to print it
help me please

Try this:

mysqli_real_query($conn, "SELECT * FROM users");

if (mysqli_field_count($link)) {
    /* this was a select/show or describe query */
    $result = mysqli_store_result($conn);

    /* process resultset */
    $row = mysqli_fetch_row($result);

    /* free resultset */
    mysqli_free_result($result);
}

Docs

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.