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

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3715e-2c06c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3715e-2c06c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?