系统盘
windows目录下的php.ini里面有一个extension_php=mysql好象是这样的,前面的号去掉没,如果没,把它去掉,保存一下,再重启IIS看
行不行
。这一般是php.ini设置问题。
分类: 电脑/网络 >>程序设计 >>其他编程语言问题描述:
我的代码是
<?
...........基本设定
$mysql_server_name = "localhost"
$mysql_username = "root"
$mysql_password = "123465"
$mysql_database = "datetable"
$sql = "select * from table"
...............
$conn= mysql_connect($mysql_server_name,$mysql_username,$mysql_password)
$result= mysql_db_query($mysql_database,$sql,$conn)
$row= mysql_fetch_row($result)
........表格开始
echo "<table border=1 cellpacing=0 cellpadding=0>\n"
......印出栏位名称
echo "<tr>\n"
for($i=0$i<mysql_num_fields($result)$i++)
{
echo "<td nowrap>".mysql_field_name($result,$i)."</td>\n"
}
echo "</tr>\n"
.....将资料移回第一笔
mysql_data_seek($result,0)
........印出资料内容
while($row= mysql_fetch_row($result))
{
echo "<tr>\n"
for($i=0$i<mysql_num_fields($result)$i++)
{
echo "<td nowrap>$row[$i]</td>\n"
}
echo "</tr>\n"
}
....表格结束
echo "</table>"
mysql_free_result($result)
?>
总提示这样的错误
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in C:\Apache2.2\htdocs\a\d.php on line 18
Warning: mysql_num_fields(): supplied argument is not a valid MySQL result resource in C:\Apache2.2\htdocs\a\d.php on line 23
Warning: mysql_data_seek(): supplied argument is not a valid MySQL result resource in C:\Apache2.2\htdocs\a\d.php on line 29
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in C:\Apache2.2\htdocs\a\d.php on line 31
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in C:\Apache2.2\htdocs\a\d.php on line 42
请高手帮帮忙,我快愁死了~~~~~~~
解析:
不是这样连的,应该是
mysql_connect($mysql_server_name,$mysql_username,$mysql_password)
mysql_select_db($mysql_database)
然后再:
$result = mysql_query("select * from table")
$row= mysql_fetch_row($result)
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)