The problem of obtaining the number of users with different IP addresses is to obtain the number of all different ip addresses in a table. The table name onlineip field name cannot obtain different ip addresses after the IP address is run, the number of identical IP addresses is also counted. I don't know where the problem is. The code is as follows: & lt ;? Php $ link_IDmysql_connect (& quot; localhost & quot;, & quot; root & quot;, & quot; 198600 & quot
The purpose is to obtain the number of all different ip addresses in a table,
Table name online
Ip field name: ip
Different IP addresses cannot be obtained after running, and the number of identical IP addresses is also counted. if you do not know where the problem is, solve it.
The code is as follows:
$ Link_ID = mysql_connect ("localhost", "root", "198600 ");
Mysql_query ("set names 'gb2312 '");
Mysql_select_db ("my_db ");
$ Srt = "select distinct ip FROM online ;";
$ Result = mysql_query ($ str, $ link_ID );
$ Rows = mysql_num_rows ($ result );
Echo $ rows;
Mysql_close ($ link_ID );
?>
------ Solution --------------------
I don't quite understand what you mean
Select count (*), ip FROM online group by ip number of users with different IP addresses
------ Solution --------------------
Modified and run. No problem .. But in the code, the variable is srt and then str ..