How select count () displays print results

Database test content statistics userName=" fight"a total of several items.

clipboard.png

:


:

clipboard.png

data shows SQL COUNT Grammar:
SQL COUNT (DISTINCT column_name) Syntax
COUNT (DISTINCT column_name) function returns the number of different values for the specified column:
SELECT COUNT (DISTINCT column_name) FROM table_name

Why can"t I display the data I need? I want to get the statistical data back to the front end for judgment. Which experienced friend can advise me as a beginner in sql and PHP

Mar.31,2021

$sql = "select count (*) as userNum from ajax_test1 where userName='$uName'";

$result = mysqli_query ($con, $sql);
$res = mysqli_fetch_array ($result);
/ / print_r ($res);
echo $res ['userNum'];

)

there is a problem with your sql splicing. UserName='$uName' is not parsed


single quotation marks do not resolve variables

Menu