-1

这段代码不起作用 - 它说我在 ** 行上有意外的 T_STRING 错误..它真的让我很烦恼..它可能是基本的,但我有点菜鸟,所以任何帮助都会很棒!

<?php

$dbhost = 'localhost';
$dbname = 'main';
$dbuser = 'root';
$dbpass = '';
$tbl_name="business";

$country = $_POST['country'];
$name = $_POST['name'];
$business_name= $_POST['business_name'];
$address1= $_POST['address1'];
$address2= $_POST['address2'];
$city= $_POST['city'];
$county= $_POST['county'];
$zip= $_POST['zip'];
$phone = $_POST['phone'];
$web_address = $_POST['web_address'];
$email= $_POST['email'];
$password=$_POST['password'];
$open= $_POST['open'];
$closed= $_POST['closed'];
$description=$_POST['description']

**mysql_connect("$dbhost", "$dbuser", "$dbpass") or die (mysql_error());**
mysql_select_db("$dbname") or die (mysql_error());


$sql_insert = "INSERT INTO $tbl_name VALUES                      ('','$country','$name','$business_name','$address1','$address2','$city','$county','$zip','$    phone','$web_address','$email','$password','$open','$closed','$description');";
$result=mysql_query($sql_insert);
$rows = mysql_num_rows($result);

if($result){
echo "Successful";
echo "<BR>";
}

else {
echo "ERROR";
}

mysql_close();
?>
4

4 回答 4

2

你需要添加一个;之后$description=$_POST['description']

于 2012-07-24T17:08:39.633 回答
2

错误是缺少分号来关闭此行:

$description=$_POST['description']

于 2012-07-24T17:08:40.097 回答
1

这是因为您在前面的代码行中缺少分号:

$description=$_POST['description']

PHP 错误消息倾向于给出解析器注意到问题的行号,而不是问题发生的位置。

于 2012-07-24T17:08:37.070 回答
1

这里缺少分号...

$closed= $_POST['closed'];
$description=$_POST['description']; <------

**mysql_connect("$dbhost", "$dbuser", "$dbpass") or die (mysql_error());**
mysql_select_db("$dbname") or die (mysql_error());
于 2012-07-24T17:08:45.040 回答