<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>php</title>
<?php//include (conn.php);
if($_POST['sub']){
$sql="insert into ko (user,mm)".
"values ('$_POST[text1]','$_POST[text2]')";
mysql_query($sql); 这句错
}
?>
</head>
<body>
<form id="form1" name="form1" method="post" action="index.php">
<p>用户:
<label for="text1"></label>
<input type="text" name="text1" id="text1" />
</p>
<p>密码:
<label for="text2"></label>
<input type="text" name="text2" id="text2" />
</p>
<p>
<input type="submit" name="sub" id="sub" value="注册" />
</p>
</form></body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>php</title>
<?php//include (conn.php);
if($_POST['sub']){
$sql="insert into ko (user,mm)".
"values ('$_POST[text1]','$_POST[text2]')";
mysql_query($sql); 这句错
}
?>
</head>
<body>
<form id="form1" name="form1" method="post" action="index.php">
<p>用户:
<label for="text1"></label>
<input type="text" name="text1" id="text1" />
</p>
<p>密码:
<label for="text2"></label>
<input type="text" name="text2" id="text2" />
</p>
<p>
<input type="submit" name="sub" id="sub" value="注册" />
</p>
</form></body>
</html>
解决方案 »
- 在php中嵌套html好呢?还是在html中嵌套php好?
- Fatal error: Cannot redeclare strlen()
- mysql函数怎么写啊? 老报错
- 如何让存于cookie的特殊字符不转义?
- 求教~~图片上传的问题
- PHP表单数据接收不到!!@@ 急急急急急在线等啊
- 谁能给我看看下面三个表的字段是什么,谢谢
- 一般的cookie有几个参数
- 可以在一个PHP程序里同时连接一个数据库的很多表吗?
- 如何运用PHP语言和Socket技术实现客户端与客户端的时时通信?
- php填写一项对应数据库后,从数据库读出其他项,然后自动添加到表单里。怎么弄?
- socket由于目标机器积极拒绝,无法连接。
语句加上,页面运行时就什么也没有
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<?php
$conn = @ mysql_connect("localhost", "root", "2283302");
mysql_select_db("yh", $conn);
mysql_query("set names 'GBK'");
?><body>
</body>
</html>
插入数据库的代码
<?php $sql="insert into ko (user,mm)values('$_POST[text1]','$_POST[text2]')";
mysql_query($sql,$conn);
?>
是不是这样写
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>php</title>
<?phpinclude (conn.php);
if($_POST['sub']){
$sql="insert into ko (user,mm)".
"values ('$_POST[text1]','$_POST[text2]')";
mysql_query($sql); 这句错
}
?>
</head>
<body>
<form id="form1" name="form1" method="post" action="index.php">
<p>用户:
<label for="text1"></label>
<input type="text" name="text1" id="text1" />
</p>
<p>密码:
<label for="text2"></label>
<input type="text" name="text2" id="text2" />
</p>
<p>
<input type="submit" name="sub" id="sub" value="注册" />
</p>
</form></body>
</html>
代码
<?php
$conn = mysql_connect("localhost", "root", "2283302") ;
mysql_select_db("yh", $conn);
echo "成功";
//mysql_query("set names 'GBK'"); //使用GBK中文编码;
?>
是哪里错?
$conn = mysql_connect("localhost", "root", "2283302") ;
mysql_select_db("yh", $conn);
echo "成功";
//mysql_query("set names 'GBK'"); //使用GBK中文编码;
?>你看看你的$conn是否有连接到数据库。
这句报错,真不懂????求救!!!!!
<?php
$conn = mysql_connect("localhost", "root", "2283302") ;他报这句错
mysql_select_db("yh", $conn);
echo "成功";
//mysql_query("set names 'GBK'"); //使用GBK中文编码;
?>