夜深深,头大大 希望早晨能得到正确解答 新人谢过!顺便说说这个函数是做啥子用的啊 php手册解释好生涩!
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\AppServ\www\js.php on line 24
<html>
<head>
<title>访客计数器</title>
<style>
p{
text-align:center;
}
</style>
<?php
$dabase = "test_jsq";$con = mysql_connect("localhost","root","12345");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$sql = "select * from test_jsq";
$result = mysql_db_query($dabase,$sql,$con);
$row = mysql_fetch_row($result);?>
</head>
<body>
<p>您是本站第999位访客</p>
</body>
</html>
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\AppServ\www\js.php on line 24
<html>
<head>
<title>访客计数器</title>
<style>
p{
text-align:center;
}
</style>
<?php
$dabase = "test_jsq";$con = mysql_connect("localhost","root","12345");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$sql = "select * from test_jsq";
$result = mysql_db_query($dabase,$sql,$con);
$row = mysql_fetch_row($result);?>
</head>
<body>
<p>您是本站第999位访客</p>
</body>
</html>
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}//加上这一段判断一下数据库有没有返回正确结果mysql_fetch_row获取查询结果中的一个记录,以数组形式返回
1、echo "<td nowrap>".mysql_field_name($result,$i)."</td>\n";
2、 echo "<td nowrao>$row[$i]</td>\n";
以上俩句为什么后者可以不用并置符但前者缺必须有呢?没有就无法正常打印字段名?
前者是一个函数调用(mysql_field_name),如果放在双引号之间会把它当字符串对待而不是函数