主题:【江湖救急】熟悉PHP+MYSQL的朋友帮个忙 -- 无情
55555555555,第一次用这个,一直报错,555555555
说是第14行错了,各位帮个忙哦......
{<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Php</title>
</head>
<body>
<?php
$dbcnx = mysql_connect("localhost","root","") or die ("cannot connect to DB");
$sql= mysql_select_db("giohot") or die ("cannot select DB");
$sql = "INSERT INTO gio(Name, Street, City, State, Tel, Email, UName, Password ) VALUES ('$name', '$street', '$city','$state','$tel', '$email', 'username', 'password')";
$result = mysql_query($strsql, $query) or die ("Cannot execute query");
if
(!$sql_result) { echo "Cannot add record"; }
else
{ echo "Record added"; };
mysql_close($connect);
?>
</body>
</html>
}
resource mysql_query ( string query [, resource link_identifier])
so in your case :
$resul= mysql_query($sql)
I didnot see you defining $query or $strsql
before you referece them. reserved word for mysql?
我也8知道是什么呀,都找8到资料,这个东西偶实在外行...
偶就是不知道$sql = "INSERT INTO 输入数据
行后怎么结束
多谢....
你定义了
$sql="insert into......";
这是个sql 名令,
下一步用:
$result=mysql_query($sql);
去执行它.
$result 存储执行情况的返回结果.
所以下面的判断也应该改为:
if(!result) .....
你试试看可以否.