為什麼我無法編輯

=====主程式=====
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<?php
include'mysql.php';
error_reporting(E_ALL ^ E_DEPRECATED);
?>
<form method="post" action="" enctype="multipart/form-date" name="form1">
名子:<input type="text" name="name" size="10">
電話:<input type="text" name="phone" size="10">
販賣:<input type="text" name="sell" size="10">
<input type="submit" value="送出"><input type="reset" value="重設">
</form>
<?php
$phone_number = $_POST['phone'];
$user_name=$_POST['name'];
$sell_name=$_POST['sell'];
if($phone_number!='')
if($user_name!='')
if($sell_name!=''	)
{
  $sql = " INSERT happytime(phone,name,sell)
         value('$phone_number','$user_name','$sell_name')";
		 mysqli_query($con,$sql);
}
 else
{
 echo"資料請勿留空白";
}
$sql = "SELECT *
       FROM happytime";
	  $result = mysqli_query($con,$sql);
	  
      $rowcount=mysqli_num_rows($result);	  
	   
	   if($rowcount>0)
       {
	
	  echo"<table border=1> <tr>
	         <td>姓名</td>
	         <td>物品</td>
		     <td>電話</td>
			 <td></td>
			 <td></td></tr>";
	    while($row = mysqli_fetch_array($result))
		{

		 echo"<tr><td>{$row['name']}</td>
		      <td>{$row['sell']}</td>
			  <td>{$row['phone']}</td>
			  <td><a href='delet.php?del={$row['number']}'>刪除</td>
			  <td><a href='edit.php?edit={$row['number']}'>編輯</td>
			  </tr>";
		}echo"</table>";
	   }
	   
	 
	   
	   ?>
	  
=========edit.php=========================
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<?php

include'mysql.php';
if($_GET['edit']!=''){
$sql="SELECT * FROM `happytime` WHERE 'number'='{$_GET['edit']}'";
$result = mysqli_query($con,$sql);

}
else
{
 header('sell.php');
}

?>
<form name="form1" method="POST" action="">
名子:<input type="text" name="name_1">
電話:<input type="text" name="phone_1">
物品:<input type="text" name="sell_1">

<input type="submit" value="送出">
<input type="reset" value="重設">
</form>
<?php
$NAME = $_POST['name_1'];
$PHONE = $_POST['phone_1'];
$SELL = $_POST['sell_1'];

if(isset($_POST['form1'])){
$sql = "UPDATE `happytime` SET `name`=[$NAME],`phone`=[$PHONE],
`sell`=[$SELL],WHERE `number`={$_GET['$edit']}";
mysqli_query($sql);
}
$row=mysqli_affected_rows($con);

if($row>0)
{
echo"成功";
}
else
{
echo"fail".mysqli_error($con);
}
echo"<br>";
?>
<a href="sell.php">home</a>
edite.php是哪裡有打錯,我要取得她的自動編號,我就可以做更改
問題為什麼$sql = "UPDATE `happytime` SET `name`=[$NAME],`phone`=[$PHONE],
`sell`=[$SELL],WHERE `number`={$_GET}";著樣打還是無法做資料表的更改
我想了好幾個禮拜,還是沒辦法. 真的需要有人幫我指導

評論

Sign In or Register to comment.