$conn=mysql_connect($serverIP,$db_user,$db_password);
mysql_select_db($database_name,$conn);$sql="select count(*) from bbb where ccc='1'";
$query=mysql_query($sql) or die(mysql_error());
$arr=mysql_fetch_array($query);
echo $arr[0];
mysql_select_db($database_name,$conn);$sql="select count(*) from bbb where ccc='1'";
$query=mysql_query($sql) or die(mysql_error());
$arr=mysql_fetch_array($query);
echo $arr[0];
解决方案 »
- 怎样才能修改Linux口令
- 关于APACHE的rewrite地址重写模块
- 大家在写PHP代码时一般缩进多少?
- 关于“||”的问题?
- 给分喽~~~~哈哈
- 50分问个简单问题。
- print "<tr><td width=100% bgcolor=$abc>fyx maggie</td></tr>";
- 如何知道当前的http://localhost/index.php是读取htdocs\下的哪个目录?
- 同一页中,js的变量怎样与php交互呀?
- php soap调用的时候会自动访问到代理服务器,如何禁止路由到代理服务器?
- 能否在session中注册类?
- 在Win2kprofessional+IIS+SQLServer上安装PHP 4.0,谁试过?
$result=mysql_query($SQL) or die(mysql_error());
$row=mysql_fetch_Array($result);
$total=$row[total];
echo"<br>共有".$total."条记录<br>";
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<?
mysql_pconnect('localhost','root','');
mysql_select_db("aaa");
$sql="select * from bbb where where ccc='1'";
$query=mysql_query($sql) or die(mysql_error());
$total=mysql_num_rows($query);
echo $total;
?>
</body>
</html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<?
mysql_pconnect('localhost','root','');
mysql_select_db("aaa");
$sql="select * from bbb where ccc='1'";
$query=mysql_query($sql) or die(mysql_error());
$total=mysql_num_rows($query);
echo $total;
?>
</body>
</html>
$conn=mysql_connect($serverIP,$db_user,$db_password);
//执行sql的函数
mysql_select_db($database_name,$conn);
//sql语句
$sql="select count(*) from bbb where ccc='1'";
//执行sql,得到结果,是一个数组
$query=mysql_query($sql) or die(mysql_error());
输出数组的第一个值,即记录数
$arr=mysql_fetch_array($query);
echo $arr[0];xx,不知道说的对不对
不同意您的 观点 我觉得还是mysql_fetch_array()好用