|
 |
|
ช่วยด้วยครับ Parse error: syntax error, unexpected T_STRING in C:\AppServ\www\COM\check.php on line 63 |
|
 |
|
|
 |
 |
|
ผิดตรงไหนอะครับ >> Parse error: syntax error, unexpected T_STRING in C:\AppServ\www\COM\check.php on line 63
Code (PHP)
<?
mysql_connect(localhost,root,1234);
mysql_select_db("user");
if(trim($_POST["user"]) == "")
{
echo "Please input Username!";
exit();
}
if(trim($_POST["pass"]) == "")
{
echo "Please input Password!";
exit();
}
if($_POST["pass"] != $_POST["conpass"])
{
echo "Password not Match!";
exit();
}
if(trim($_POST["email"]) == "")
{
echo "Please input email!";
exit();
if(trim($_POST["status"]) == "")
{
echo "Please input status!";
exit();
if(trim($_POST["namel"]) == "")
{
echo "Please input email!";
exit();
if(trim($_POST["sname"]) == "")
{
echo "Please input sname!";
exit();
if(trim($_POST["phone"]) == "")
{
echo "Please input phone!";
exit();
}
$strSQL = "SELECT * FROM member WHERE User = '".trim($_POST['user'])."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if($objResult)
{
echo "Username already exists!";
}
else
{
$strSQL = "INSERT INTO member (user,pass,email,Status,name,sname,phone) VALUES ('".$_POST["user"]."',
'".$_POST["pass"]."','".$_POST["email"]."','".$_POST["Status"]."','".$_POST["name"]."','".$_POST["sname"]."','".$_POST["phone"]."');
$objQuery = mysql_query($strSQL);
echo "Register Completed!<br>";
echo "<br> Go to <a href='page.php'>Login page</a>";
}
mysql_close();
?>
Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2012-03-10 14:03:39 |
By :
บาส |
View :
1146 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

รายละเอียดฐานข้อมูล
|
 |
 |
 |
 |
Date :
2012-03-10 14:06:10 |
By :
บาส |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
from การสมัคร
Code (PHP)
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="96" align="left" valign="top" class="style7" >๊User</td>
<td width="10" align="center" valign="top" class="style9" >:</td>
<td width="322" align="left" valign="middle" class="style7"><input name='Username' type='text' value='' size='25' maxlength="10"/>
<span class="style11">* ไม่เกิน 10 ตัวอักษร (เฉพาะภาษาอังกฤษ)</span></td>
</tr>
<tr>
<td align="left" class="style7">Password</td>
<td align="center" class="style9">:</td>
<td align="left" valign="middle" class="style7"><input name='Password' type='password' value='' size='25' maxlength="10" />
<span class="style11">* ไม่เกิน 10 ตัวอักษร</span></td>
</tr>
<tr>
<td align="left" class="style7">Re - Password</td>
<td align="center" class="style9">:</td>
<td align="left" valign="middle" class="style7"><input name='conpass' type='password' value='' size='25' maxlength="10" id="conpass" />
<span class="style11">* ไม่เกิน 10 ตัวอักษร</span></td>
</tr>
<tr>
<td align="left" class="style7">E - Mail</td>
<td align="center" class="style9">:</td>
<td align="left" valign="middle" class="style7"><input name='email' type='text' size='25' value='' />
<span class="style11"> * เฉพาะภาษาอังกฤษ </span></td>
</tr>
<tr>
<td align="left" class="style7"><span class="style15">ประเภทสมาชิก</span></td>
<td align="center" class="style9">:</td>
<td align="left" valign="middle" class="style7"><select name="status" id="status">
<option value="" selected="selected">เลือกประเภทสมาชิก</option>
<option value="teacher">teacher</option>
<option value="student">student</option>
</select>
<span class="style11">* ตามความจริง</span></td>
</tr>
<tr>
<td align="left" class="style7">ชื่อ</td>
<td align="center" class="style9">:</td>
<td align="left" valign="middle" class="style11"><input name='name' type='text' size='25' value='' />
<span class="style7">* ตามความจริง</span></td>
</tr>
<tr>
<td align="left" class="style7"><span class="style15">นามสกุล</span></td>
<td align="center" class="style9">:</td>
<td align="left" valign="middle" class="style11"><input name='surname' type='text' size='25' value='' />
<span class="style7">* ตามความจริง</span></td>
</tr>
<tr>
<td align="left" class="style7"><span class="style15">เบอร์โทรศัพท์</span></td>
<td align="center" class="style9">:</td>
<td align="left" valign="middle" class="style11"><input name="phone" type="text" value="08" size="25" id="phone" />
<span class="style7">* ตามความจริง</span></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td align="left" valign="middle" class="style7"><form id="form1" name="form1" method="post" action="">
<textarea name="textarea" id="textarea" cols="45" rows="3">เงื่อนไข
1.ข้อมูลดังกล่าวกรอกตามความจริง
2.ห้ามกระทำการใดที่ผิดต่อกฎหมาย</textarea>
</form> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td align="left" valign="middle" class="style7"><input name="checkbox" type="checkbox" class="style7" id="checkbox" />
ข้าพเจ้ายอมตามเงื่อนไข</td>
</tr>
<tr>
<td></td>
<td></td>
<td align="left" valign="middle"><form action="check.php" method="post" enctype="application/x-www-form-urlencoded" name="form2" target="_blank" id="form2">
<input name="submit" type="submit" value=" ตกลง " />
<input name="reset" type="reset" onclick="history.go(-1);" value="ยกเลิก" />
<input type="reset" name="Reset" id="button" value=" Reset " />
</form></td>
</tr>
</table>
|
 |
 |
 |
 |
Date :
2012-03-10 14:08:13 |
By :
บาส |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
mysql_connect("localhost","root","1234");
mysql_select_db("user");
if(trim($_POST["user"]) == "")
{
echo "Please input Username!";
exit();
}
if(trim($_POST["pass"]) == "")
{
echo "Please input Password!";
exit();
}
if($_POST["pass"] != $_POST["conpass"])
{
echo "Password not Match!";
exit();
}
if(trim($_POST["email"]) == "")
{
echo "Please input email!";
exit();
}
if(trim($_POST["status"]) == "")
{
echo "Please input status!";
exit();
}
if(trim($_POST["namel"]) == "")
{
echo "Please input email!";
exit();
}
if(trim($_POST["sname"]) == "")
{
echo "Please input sname!";
exit();
}
if(trim($_POST["phone"]) == "")
{
echo "Please input phone!";
exit();
}
$strSQL = "SELECT * FROM member WHERE User = '".trim($_POST['user'])."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if($objResult)
{
echo "Username already exists!";
}
else
{
$objQuery = mysql_query($strSQL);
$strSQL = "INSERT INTO member ";
$strSQL .="(user,pass,email,Status,name,sname,phone) ";
$strSQL .="VALUES ";
$strSQL .="('".$_POST["user"]."','".$_POST["pass"]."','".$_POST["email"]."' ";
$strSQL .=",'".$_POST["Status"]."','".$_POST["name"]."','".$_POST["sname"]."','".$_POST["phone"]."') ";
$objQuery = mysql_query($strSQL);
echo "Register Completed!<br>";
echo "<br> Go to <a href='page.php'>Login page</a>";
}
mysql_close();
?>
เข้าไปดูเป็นตัวอย่างนะครับ น่าจะช่วยได้
https://www.thaicreate.com/php/php-mysql-add-insert-record.html
คุณลืมอะไรๆ ไปหลายอย่าง ไม่ปิด }
|
 |
 |
 |
 |
Date :
2012-03-10 14:30:51 |
By :
pokultra |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|