mysql count into PHP variable

前端 未结 2 531
闹比i
闹比i 2020-12-03 09:02

Let say that we have the following query:

SELECT DISTINCT COUNT(`users_id`) FROM `users_table`;

this query will return the number of the us

2条回答
  •  佛祖请我去吃肉
    2020-12-03 10:01

    Also, an alternative using mysqli, which you should be using anyway for parameter interpolation:

    $statement = $connection->prepare($the_query_from_above);
    $statement->execute();
    $statement->bind_result($nr_of_users);
    $statement->fetch();
    

提交回复
热议问题