예기치 않은 $ end 구문 오류가 계속 발생합니다.
코드를 검사했지만 아무 문제가 없습니다. 나는 모든 여는 괄호와 닫는 괄호를 검사했다. 무슨 문제가있는 것 같습니까?
내 코드 :
<?php
setcookie('name',$_POST['name']);
setcookie('lname',$_POST['lname']);
setcookie('add',$_POST['add']);
setcookie('age',$_POST['age']);
setcookie('contact',$_POST['contact']);
setcookie('email',$_POST['email']);
setcookie('user',$_POST['user']);
setcookie('pass',$_POST['pass']);
$con=mysql_connect("localhost","root","");
mysql_select_db("nnx",$con);
$tbl=mysql_query("SELECT * FROM tablename WHERE `username` = '".mysql_real_escape_string($_POST['user'])."'");
while($row=mysql_fetch_array($tbl))
{
if($_POST['user']==$row['username'])
{
header("location: /register.php?codeErr2=1");
die;
}
$name=$_POST['name'];
$lname=$_POST['lname'];
$add=$_POST['add'];
$age=$_POST['age'];
$contact=$_POST['contact'];
$email=$_POST['email'];
$user=$_POST['user'];
$pass=$_POST['pass'];
if(($name!="")&&($lname!="")&&($add!="")&&($age!="")&&($contact!="")&&($email!="")&& ($user!="")&&($pass!=""))
{
$value=mysql_query("INSERT INTO tablename(name, lastname, address, age, contact, email, username, password)
VALUES ('".$_POST['name']."','".$_POST['lname']."','".$_POST['add']."','".$_POST['age']."','".$_PO ST['contact']."','".$_POST['email']."','".$_POST['user']."','".$_POST['pass']."')");
}
else
{
header("location: /register.php?codeErr=1");
}
?>
<html>
<body bgcolor="green">
<center>
<h1>Welcome! These are the offered products</h1>
<table border="1" width="1000" height="500" bgcolor="yellow">
<tr>
<th>Product</th>
<th>Description</th>
</tr>
<tr>
<td>GARLIQUE</td>
<td>GARLIQUE
The All Natural Dietary Supplement
Produced from fresh garlic
</td>
</tr>
<tr>
<td>Right-CEE</td>
<td>Right-CEE (Sodium Ascorbate) …
</td>
</tr>
<tr>
<td>OLEIA</td>
<td>OLEIA CAPSULE
No More Pain, Heart to Gain
</td>
</tr>
</table>
<br>
<br>
<form name="product" action="order.php" method="post">
<input type="submit" value="Order">
</form>
</body>
</html>
대답은 다음과 같습니다. http://stackoverflow.com/search?q=PHP+%3A+Parse+error%3A+syntax+error%2C+unexpected+%24end - 대괄호가 잘못 일치했습니다. 관련 칼럼을보십시오. –
이 코드에는 많은 문제가 있습니다. 보안에 대해 읽어주십시오 : http://docforge.com/wiki/Web_application/Security –