不好意思,我的語法是這樣,都已經是照抄原本UPDATE更新成功的程式碼了,只是換了另一個資料表和變數,結果按更新資料的時候卻沒有更新成功,不瞭解是變數設定的問題,還是PHP資料庫設定的問題?
<?php
header("Content-Type: text/html; charset=big5");
include("connMysql.php");
if (!@mysql_select_db("hmo")) die ("link fail");
mysql_query("SET NAMES 'big5'");
if(isset($_POST["action"])&&($_POST["action"]=="yes")){
$sql_query="UPDATE `pharmacy` SET";
$sql_query.="`cName2`='".$_POST["cName2"].",";
$sql_query.="`cProcess`='".$_POST["cProcess"].",";
$sql_query.="`cResult`='".$_POST["cResult"].",";
$sql_query.="`cDoctor`='".$_POST["cDoctor"].",";
$sql_query.="`cRecomment`='".$_POST["cRecomment"].",";
$sql_query.="`cEnd`='".$_POST["cEnd"].",";
mysql_query($sql_query);
//重新導向回到主畫面
header("Location:hmo-pharmacy3.php");
}
$sql_db="SELECT * FROM `pharmacy` WHERE `cID`=".$_GET["id"];
$result=mysql_query($sql_db);
$row_result=mysql_fetch_assoc($result);
?>
<?php
header("Content-Type: text/html; charset=big5");
include("connMysql.php");
if (!@mysql_select_db("hmo")) die ("link fail");
mysql_query("SET NAMES 'big5'");
if(isset($_POST["action"])&&($_POST["action"]=="yes")){
$sql_query="UPDATE `pharmacy` SET";
$sql_query.="`cName2`='".$_POST["cName2"].",";
$sql_query.="`cProcess`='".$_POST["cProcess"].",";
$sql_query.="`cResult`='".$_POST["cResult"].",";
$sql_query.="`cDoctor`='".$_POST["cDoctor"].",";
$sql_query.="`cRecomment`='".$_POST["cRecomment"].",";
$sql_query.="`cEnd`='".$_POST["cEnd"].",";
mysql_query($sql_query);
//重新導向回到主畫面
header("Location:hmo-pharmacy3.php");
}
$sql_db="SELECT * FROM `pharmacy` WHERE `cID`=".$_GET["id"];
$result=mysql_query($sql_db);
$row_result=mysql_fetch_assoc($result);
?>