UID4470
帖子
精華
主題
積分1616
現金
積極性
威望
違規
熱心
推廣次數
閱讀權限10
註冊時間2007-8-21
在線時間 小時
最後登錄1970-1-1
TA的每日心情 | 開心 2022-6-19 03:56 AM |
---|
簽到天數: 260 天 連續簽到: 1 天 [LV.8]以壇為家I
|
發表於 2010-3-19 21:08:05
|
顯示全部樓層
本帖最後由 听心悸動 於 2010-3-19 09:15 PM 編輯
php不是很熟 記算筆數好像不是用count 用mysql_num_rows 才對
試試 用這個
$usergs1 = 0;$res = mysql_query("SELECT * FROM `char` where online =1");$usergs1 =mysql_num_rows($res);
if($usergs1 == 0) ...
sinya 發表於 2010-3-19 04:52 AM 
我把這段代碼覆蓋過去了
但是人數居然是顯示1...
我線上人數約6x人..
這個是我的 "index.php"
請大大過目哪邊改錯@@"-
- <?PHP
- $title = "____(�▽�)~*____";
- require './inc/header.inc';
- echo ("<TABLE align='center'>");
- error_reporting(0);
- $IP = array("<font size=-2>登陸伺服器:" => "".$loginip.":".$loginport."","<font size=-2>人物伺服器:" => "".$charip.":".$charport."","<font size=-2>地圖伺服器:" => "".$mapip.":".$mapport."",);
- while(list($ServerName,$Host)=each($IP)) {
- list($IPAddress,$Port)=explode(":",$Host);
- echo("<TD><DIV>".$ServerName."</DIV></TD><TD>");
- if($fp=fsockopen($IPAddress,$Port,$ERROR_NO,$ERROR_STR,(float)0.5)) {
- echo("<DIV style="color:'green'"><font size=-2>正常在線</DIV>");
- fclose($fp); }else{ echo("<DIV style="color:'red'"><font size=-2>未知狀態</DIV>");} echo ("</TD></TR><TR>");}
- $usergs1 = 0;$res = mysql_query("SELECT char_id FROM `char` where onlie =1");$row = mysql_fetch_array($res);$usergs1 = count($row);
- if($usergs1 == 0) {$usergs2 = '0'; } else { $usergs2 =$usergs1; }
- echo ("<tr><td><font size=-3> 在線人數: </td><td><font size=-2 color=blue>".$usergs2."</font></td></tr>");
- echo ("</TABLE>");
- require './inc/indexfooter.inc';
- ?>
複製代碼
我的首頁:http://ting790121.no-ip.info/ro/ |
|