查看: 728|回复: 4
|
php & mysql (update problem)
[复制链接]
|
|
when i click submit , it come out this error message
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in c:\program files\easyphp1-7\www\spm_projects\admin\update\memedit.php on line 12
why ???
here my coding
--------------------------------------------------------------------------
update.html
<html>
<head>
<title>New Page 1</title>
</head>
<body>
<form method=POST action=memedit.php>
<p> </p>
<p> <font color="#009933">Book ID :
<input type="text" name="T2" size="20"></font></p>
<p> </p>
<p><input type="submit" value="Submit" name="B1"> <input type="reset" value="Reset" name="B2"></p>
</form>
</body>
</html>
--------------------------------------------------------------------------
memedit.php
<?php
$aa="select * from book where bookID='$T2'";
$bb=mysql_query($aa);
list($T0,$D1,$T1,$T2,$T3,$T4,$T5,$T6,$T7,$T8) = mysql_fetch_row($bb);
echo "
<form method=POST action='memedit2.php'>
<p> </p>
<p> <font color="#009933"> Category ID :</font> <select name="D1">
<option value=1"; if ($D1==1) {echo " selected";} echo ">1
<option value=2"; if ($D1==2) {echo " selected";} echo ">2
<option value=3"; if ($D1==3) {echo " selected";} echo ">3
<option value=4"; if ($D1==4) {echo " selected";} echo ">4
<option value=5"; if ($D1==5) {echo " selected";} echo ">5
<option value=6"; if ($D1==6) {echo " selected";} echo ">6
<option value=7"; if ($D1==7) {echo " selected";} echo ">7
<option value=8"; if ($D1==8) {echo " selected";} echo ">8
</select></p>
<p> <font color="#009933">Book ID :
$T2</font></p>
<p><font color="#009933"> Book Name :
<input type="text" name="T1" size="50" value=$T1></font></p>
<p><font color="#009933"> Author :
<input type="text" name="T3" size="30" value=$T3></font></p>
<p><font color="#009933"> Publisher:
<input type="text" name="T4" size="30" value=$T4></font></p>
<p><font color="#009933"> ISBN :
<input type="text" name="T5" size="30" value=$T5></font></p>
<p><font color="#009933"> Price (RM) : </font>
<input type="text" name="T6" size="30" value=$T6></p>
<p> </p>
<p><input type="submit" value="Update" name="B1"> <input type="reset" value="Reset" name="B2"></p>
</form>
";
?>
--------------------------------------------------------------------------
memedit2.php
<?php
mysql_connect("localhost","root","1234"
mysql_select_db("book"
$aa="
update book set
bookname='$T1',
author='$T3',
publisher='$T4',
isbn='$T5',
price='$T6',
where bookid='$T2'
";
mysql_query($aa);
header("location:update.html"
?> |
|
|
|
|
|
|
|
发表于 27-8-2006 06:28 PM
|
显示全部楼层
|
|
|
|
|
|
|
楼主 |
发表于 27-8-2006 06:32 PM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 27-8-2006 09:54 PM
|
显示全部楼层
|
|
|
|
|
|
|
楼主 |
发表于 27-8-2006 10:18 PM
|
显示全部楼层
原帖由 亡者之疯 于 27-8-2006 09:54 PM 发表
我以为你已经解决问题了~
@_@
你试下:
<?php
$D1=2;
echo "<select name='D1'><option value='1' "; if($D1==1) echo 'selected'; echo " >1</option>
<o ...
我已经解决... i change it like below
--------------------------------------------------------------------------
<html>
<head>
<title>New Page 1</title>
</head>
<body>
<?php
$link_id=mysql_connect("localhost", "root","1234");
mysql_select_db("spm");
$str="select bookid from book";
$result=mysql_query($str,$link_id);
$sn_index=mysql_num_rows($result);
mysql_close($link_id);
for($index=0;$index<$sn_index;$index++){
$arr[$index]=mysql_fetch_array($result);
};?>
<?php
if(isset($T1) and isset($T2) and isset($T3) and
isset($T4) and isset($T5) and isset($T6)){
$link_id = mysql_connect("localhost", "root","1234");
mysql_select_db("spm");
$str="
update book set
bookname='$T1',
author='$T3',
publisher='$T4',
isbn='$T5',
price='$T6'
where bookid='$T2'";
mysql_query($str,$link_id);
mysql_close($link_id);
};
?>
<form method=post action=tryup1.php>
<p> <font color="#009933"> BookID :</font>
<select name="T2">
<?
for($index=0;$index<$sn_index;$index++){
?>
<option><?echo $arr[$index]['bookid']?>
<?};?>
</select>
<p><font color="#009933"> Book Name :
<input type="text" name="T1" size="50"></font></p>
<p><font color="#009933"> Author :
<input type="text" name="T3" size="30"></font></p>
<p><font color="#009933"> Publisher:
<input type="text" name="T4" size="30"></font></p>
<p><font color="#009933"> ISBN :
<input type="text" name="T5" size="30"></font></p>
<p><font color="#009933"> Price (RM) : </font>
<input type="text" name="T6" size="30"></p>
<p> </p>
<p><input type="submit" value="Submit" name="B1"> <input type="reset" value="Reset" name="B2"></p>
</form>
</body>
</html>
-------------------------------------------------------------------------- |
|
|
|
|
|
|
| |
本周最热论坛帖子
|