syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE
มันขึ้น error อย่างงี้อ่าค่ะ
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\xampp\htdocs\project\php_exerciseEdit.php on line 19
ช่วยดูโ้ค้ดให้หน่่อยนะคะ ไม่รุ้ว่าผิดตรงไหน
Code (PHP)
<?php
session_start();
$hostname_conn = "localhost";
$username_conn = "root";
$password_conn = "1234";
$database_conn = "myproject";
mysql_connect( $hostname_conn , $username_conn , $password_conn ) or die( "เชื่อมต่อฐานข้อมูลไม่ได้" );
mysql_query("SET NAMES UTF8");
mysql_select_db( $database_conn ) or die( "เลือกฐานข้อมูลไม่ได้" );
$dbID=$_SESSION[dbID];
$setID=$_SESSION[setID];
$sql="SELECT * FROM sub_exercise WHERE dbID='$dbID' AND setID='$setID'";
$result=mysql_query($sql) or die (mysql_error());
?>
</div>
<form id="form1" name="form1" method="post" action="php_exerciseEdit.php">
<p class="style9"><span class="style12">
<label>
<div align="left">
<?php
while($row=mysql_fetch_array($result))
{
$no=$row["exerciseID"];
$question=$row["Question"];
$answer=$row["Answer"];
echo "ข้อที่ $no.</b>\n";
?>
<input name="check[]" type="checkbox" value="<?php echo $no; ?>"/>
<textarea name="question[]" rows="4" cols="40"><?php echo $question;?></textarea>
<textarea name="answer[]" rows="4" cols="40"><?php echo $answer;?></textarea>
<?php
echo "<br>";
}
?>
</label>
<p class="style9">
<label>
<div align="center">
<input type="submit" name="button" id="button" value="Submit">
<input type="reset" name="button2" id="button2" value="Reset">
</label>
<label></label>
</form></td>
php_exerciseEdit.php
Code (PHP)
<?php
session_start();
$hostname_conn = "localhost";
$username_conn = "root";
$password_conn = "1234";
$database_conn = "myproject";
mysql_connect( $hostname_conn , $username_conn , $password_conn ) or die( "เชื่อมต่อฐานข้อมูลไม่ได้" );
mysql_query("SET NAMES UTF8");
mysql_select_db( $database_conn ) or die( "เลือกฐานข้อมูลไม่ได้" ); // เลือกฐานข้อมูล
$dbID=$_SESSION[dbID];
$setID=$_SESSION[setID];
foreach($_POST['check'] as $value):
if(isset($value))
{
$no=$value-1;
echo $_POST['question'][$no]."<br>";
$sql="UPDATE sub_exercise SET dbID=$dbID,setID=$setID,exerciseID=$value,Question='$_POST['question'][$no]',Answer='$_POST['answer'][$no]' WHERE exerciseID=$value";
$result=mysql_query($sql) or die(mysql_error());
echo "insert complete";
}
endforeach;
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
</body>
</html>
Tag : - - - -
Date :
2009-12-14 17:10:38
By :
independence55
View :
1650
Reply :
1
Answer='$_POST['answer']
เอา 'answer' ออก เป็น
Answer = '$_POST[answer]
Date :
2009-12-14 17:14:08
By :
teez1232002
Load balance : Server 05