 |
ไม่เข้าใจครับsyntax error, unexpected T_STRING in C:\AppServ\www\New Folder\regisSave.php on line 18 |
|
 |
|
|
 |
 |
|
Parse error: syntax error, unexpected T_STRING in C:\AppServ\www\New Folder\regisSave.php on line 18
ไม่รู้เป็นที่อะไร งง มากครับ ยิ่งมือใหม่หัดเขียน
Code (PHP)
<?php
<?
$user=$_POST['user']; $pass=$_POST['pass'];
$repass=$_POST['repass']; $name=$_POST['name'];
$lname=$POST['lname']; $gender=$_POST['gender'];
$day=$POST['day']; $month=$_POST['month'];
$year=$POST['year']; $address=$_POST['month'];
$email=$_POST['email'];
if(empty($_POST['intr']) )
$intr="";
else
$intr=implode(",",$_POST['intr']);
if(!checkdate($month,$day,$year))
exit("<script>alert('วันเกิดไม่ถูกต้อง');history.back();</script>");
echo "$user<br/> $pass<br/> $name<br/> $lname<br/> $gender<br/> $day<br/> $month<br/> $year<br/> $address<br/> $email<hr/>
$intr";
echo"connect data base <br><br><br>";
$conn=@msql_conect("localhost","root","1234") or exit("Error at server);
mysql_select_db("test",$conn) or die("Not Found Database");// <<< ตรงนี้แหล่ะครับ งงมากๆ -*-
$sql ="select*from menber where user = '$user'";
$table=mysql_query($sql) or die(Error : $sql <hr>".mysql_error());
$count = mysql_num_rows($table);
if($count==0)
{
$birthday = "Syear-$month-$day";
$sql = "insert into member set user = '$user',pass='$pass',name='$name',
lname='$lname',gender='$gender',birthday='$birthfay',address='$address',
email='$email',intr='$intr',
regis_date_time = NOW()"
$table = mysql_query ($sql) or die ("Error : $sql <hr>".mysql_error());
exit("<script>alert<('สมัครเสร็จสิ้น');
window.location = 'index.php';</script>");
}
else
{
exit("<script>alert('username ซ้ำ');history.back();</script>");
}
?>
<!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>Untitled Document</title>
</head>
<body>
</body>
</html>
?>
Code อาจจะดูยากไปหน่อยนะครับ ขอโทดล่วงหน้าด้วยครับ T_T
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
2009-09-18 04:48:18 |
By :
vomyang |
View :
1647 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เท่าที่เห็น
Code (PHP)
<?php
$conn=@msql_conect("localhost","root","1234") or exit("Error at server);
แก้เป็น
$conn=mysql_connect("localhost","root","1234") or exit("Error at server);
$sql = "insert into member set user = '$user',pass='$pass',name='$name',lname='$lname',gender='$gender',birthday='$birthfay',address='$address',email='$email',intr='$intr',regis_date_time = NOW()" // ที่มันฟ้อง error T_STRING เพราะลืม ; ครับ
แก้เป็น
$sql = "insert into member set user = '$user',pass='$pass',name='$name',lname='$lname',gender='$gender',birthday='$birthfay',address='$address',email='$email',intr='$intr',regis_date_time = 'NOW()'";
$sql ="select*from menber where user = '$user'";
แก้เป็น
$sql ="select * from member where user = '$user'";
?>
ถ้าคิดว่าตัวเองยังมือใหม่อยู่น่ะครับ ควรเริ่มต้นง่ายๆก่อน เช่นติดต่อ sql ให้ได้ก่อนครับ
แล้วถ้าโค้ดยาวแล้วมี error วิธีเช็คก็ปิดส่วนโค้ดที่คิดว่ามันerrorแล้วไล่ทดสอบไปทีละเรื่อยๆน่ะครับเป็นเทคนิคง่ายๆ
|
 |
 |
 |
 |
Date :
2009-09-18 05:39:29 |
By :
xbeginner01 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลืมดู error line
มันผิดตั้งแต่บรรทัด 18 ลืม "
Code (PHP)
<?php
$conn=@msql_conect("localhost","root","1234") or exit("Error at server);
แก้เป็น
$conn=mysql_connect("localhost","root","1234") or exit("Error at server");
?>
|
 |
 |
 |
 |
Date :
2009-09-18 05:48:20 |
By :
xbeginner01 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณครับ
|
 |
 |
 |
 |
Date :
2009-09-18 17:28:03 |
By :
vomyang |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เจอเหมือนกันเลย
|
 |
 |
 |
 |
Date :
2009-10-08 22:22:57 |
By :
apicha31 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|