我需要幫助我的Web服務項目,其中用戶在提交訂單時創建訂單,驅動程序通過接受或拒絕訂單以及當他接受訂單明細列表時顯示通知給他。這些全部過程都通過訂單表單提交完成。我的所有編碼工作正常。我不明白從獲取當前訂單列表的位置。 PLZ給解決方案。 thx表單提交後獲得最後一條記錄的數據庫中的ID
<?php
if(isset($_POST['order_form']))
{
mysql_connect('localhost','root','');
mysql_select_db('live_help');
$user = $_POST['user'];
$password = $_POST['mobile'];
$password = $_POST['address'];
$password = $_POST['order_item'];
$password = $_POST['price'];
$sql= mysql_query("insert into `json_web`(user,mobile,address,order_item,price) values('$user','$mobile','$address','$order_item','$price')");
if($sql)
{
echo 'Value Saved';
}
}
?>
<form name="order_form" action="" method="post">
<input type="text" name="user">
<input type="text" name="mobile">
<input type="text" name="address">
<input type="text" name="order_item">
<input type="text" name="price">
<input type="submit" name="field1" value="Submit" />
</form>
清晰閱讀此選擇:HTTP:// PHP .net/manual/en/function.mysql-insert-id.php – 2014-10-07 06:27:24