今天闲的无事就来写文章了,写个mysql_fetch_array()函数运用好了。需要对新手有帮助
mysql_fetch_array()函数作用:
返回根据从结果集取得的行生成的数组,如果没有更多行则返回 FALSE。
下面在写个实例:
<?
$conn=mysql_connect("123.3.88.46","xiaodai","jishuwenzhang")or die ("连接失败 ".mysql_error()); //创建数据库连接
mysql_select_db("uan",$conn) or die ("无法选择 ".mysql_error()); //选择要操作的数据库
mysql_query("set names 'gb2312'");
$rs=mysql_query("select count(*) from mianf where leix='jingtai'",$conn);
while($myrow=mysql_fetch_array($rs))
{
echo"$myrow[0]";
}
?>
OK打完收工,需要对大家帮助
本文来自:PHP小戴(www.phpxd.com) 详细出处参考:http://www.phpxd.com/jishuwenzhang/2008-12-21/200812211349280.html