打开了,绿灯亮着。 我建立与mysql数据库服务的连接,然后关闭连接。 <? php $link=mysql_connect("localhost","root","root"); echo $link."<br>"; $close=mysql_close($link); echo $close; ?> 正常显示 resource id #1 resource id #2 可显示是 Resource id #1Warning: Unknown MySQL Server Host 'Resource id #1' (2) in D:\phptest\system1\222.php on line 10Warning: MySQL Connection Failed: Unknown MySQL Server Host 'Resource id #1' (2) in D:\phptest\system1\222.php on line 10 什么原因。怎样解决?
PHP。INI中写的明明白白,mysql和ODBC已经内置了,所以不必另加extentions DLL. ;Windows Extensions ;Note that MySQL and ODBC support is now built in, so no dll is needed for it. 我用的时候,4.20和4.21都没有问题,可能是你的代码有点小问题吧。
php\extension里有php_msql.dll 和php_mssql.dll
(1)一样吗,如果不一样,php_mysql.dll在哪里找?
奇怪,我装的是php-4.2.0-Win32.zip 和mysql-3.23.47-win.zip。
有个php-4.2.1-installer.exe,我没装。
(2)但php一般运行还可以。用装他吗,要装装到哪里? 谢谢。
有这段程序
<html>
......
<script language="javascript">
<!--
//设置名称域为输入焦点。
function namegotfocus() {
document.frmlogin.username.focus();
}
..........
运行时出现 当前脚本出现错误,行8 字符9 错误 缺少':'
第8行是“function namegotfocus(){ ” 行
我这是书上代码,检查无误,为什么,请指教。
谢谢。
默认就支持阿
怎样看到 mysql里的库中的表里的纪录。
一样可以用php连上的
手动加了记录 "[email protected]","1","1",..."
<?php
$con=mysql_connect("localhost","root","root");
mysql_select_db("board");
$query="select email ";
$query.="from board where flag=1";
$result=mysql_query("$query",$con);
while ($r=mysql_fetch_row($result)){
$email=$r[0];
}
echo "$r[0]";
?>
运行就出错 8行 有误
去掉则显示空白,是不是没连上数据库,库记录是有的。还是其他问题,请指教,谢谢。
我建立与mysql数据库服务的连接,然后关闭连接。
<? php
$link=mysql_connect("localhost","root","root");
echo $link."<br>";
$close=mysql_close($link);
echo $close;
?>
正常显示
resource id #1
resource id #2
可显示是
Resource id #1Warning: Unknown MySQL Server Host 'Resource id #1' (2) in D:\phptest\system1\222.php on line 10Warning: MySQL Connection Failed: Unknown MySQL Server Host 'Resource id #1' (2) in D:\phptest\system1\222.php on line 10
什么原因。怎样解决?
不用手动打开的,你把他恢复到默认之
一般mysql不用设置
然后,运行mysqld-shareware
就可以了
(98下应该是闪一下就没有了,其实已经运行了)
2000下应该以
:三、MySQL安装(mysql-3.23.27-beta-win.zip)
1. 先安装mysql,默认安装路径为:c:\mysql
2. 打开“运行”输入C:\mysql\bin\mysqld-nt.exe –install
3. 打开“管理工具”->“服务”,找到“mysql”服务,启动它。重启windows2000。
(我可能是看不了了,睡觉~~~~~~~~~~~)
;Windows Extensions
;Note that MySQL and ODBC support is now built in, so no dll is needed for it.
我用的时候,4.20和4.21都没有问题,可能是你的代码有点小问题吧。
//这是文件post.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>欢迎到我的留言板</title>
<body bgcolor="#FFFFFF" text="#000000">
<script language="javascript">
<!--
//设置名称域为输入焦点
fuction namegotfocus( )
{
document.frmlogin.username.focus();
}
//检查输入的合法性,即text和username的值不能为空
function checkvalid() {
if (document.frmlogin.username.value=="") {
alter("请输入昵称");
document.frmlogin.username.focus();
return false;
}
if (document.frmlogin.text.value=="") {
alter (" 你的留言呢?");
document.frmlogin.text.focus();
return false;
}
return true;
}
</script><form mehtod="post" name="frmlogin" target="_top" action="send.php">
<table border="0" width="980" height="249">
<tr>
<td width="970" height="16" colspan="3">
<p align="center"><b><font size="5" > 我要留言</font></b></td>
</tr>
<tr>
<td width="143" height="23">
<p align="right">昵称:</td>
<td width="821" colspan="2" height="23">
<input type=text name=username>(*必填)
</tr>
<tr>
<td width="143" height="23">
<p align="right">您的email:</td>
<td width="821" colspan="2" height="23">
<input type=text name=email>
<tr>
</tr>
<td width="143" height="16">
<p align="right"></td>
<td width="821" height="16" colspan="2">内容:</td>
</tr>
<tr>
<td width="143" height="299" rowspan="2"></td>
<td width="821" height="40" colspan="2">
<p align="left"><textarea row="13" name=text cols="57"></textarea>(*必填)</p>
<p></td>
</tr>
<tr>
<td width="368" height="24">
<input type="submit" value="提交" name=decision onclick="return checkvalid();">
<input type="reset" value="全部重写" name="b2"></td>
<td width="452" height="24"><input type="submit" value="放弃" name=decision></td>
</tr>
<tr>
<td width="963" height="51" colspan="3"></td>
</tr>
</table>
<?php
$create=date("20y.m.d.H:i:s ");
?>
<input type="hidden" name=created value=<?php echo "$created"?> >
</form>
</body>
</html>
<!-这是文件send.php>
<?php
if (isset($decision) and ($decision=="提交")){
//这是用户按下按钮“提交”时的情况
$con=mysql_connect("localhost","root","root");
mysql_select_db("board");
$query="insert into board(usename,text,email,serial,ip,time,) values('$username','$text','$email',null,'$remote_addr','$created')";
$result=mysql_query("$query",$con);
mysql_close($con);
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>留言发送成功</title>
</head>
<body>
<p align="center"><b><font size="6">恭喜,您的留言已经发送完毕了!
</font></b></p><form method="post" action="board.php>
<p align="center"><input type="submit" value="查看留言" name="b1"></p>
</form>
<p align="center"></p>
</body>
</html>
<?php
}
//按”放弃“按钮时的情况
if (isset($decision)and($decision=="放弃")){
include("board.php");}
?>
可显示是空白,数据库空白,每加上
数据库board,表board,字段usename,serail,flag,text,emailip,time。