您的位置:首页 > 编程语言 > PHP开发

PHP连接MYSQL实例一

2009-08-29 22:54 645 查看
$link = mysql_connect("localhost", "mysql_user", "mysql_password")
<?//这是文件write.php
if (($username!="") and ($text!=""))
{//连接MYSQL数据库
$connect=mysql_connect("localhost","root","");
//为字段插入值
$query="insert into talk(username,date,text) values ('$username','$date','$text')";
//执行MYWEB数据表
$result=mysql_db_query("myweb",$query);
}
?>
<html>
<head>
<title>user input</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="fffffff" text="#000000">
<form method="post" action="write.php"><p>
您的ID:<INPUt type="text" name="userid" size="12">
发言<input type="text" name="text" size="57">
<input type="submit" value="提交"></p>
</form>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: