<?php
require("libs/connection_to_abc.php");
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
//$member_id = $_POST["member_id"];
//$name = $_POST["name"];
//$address = $_POST["address"];
//$total_price = $_POST["total_price"];
$member_id ='1';
$name ='royle';
$address = 'cmru';
$total_price = '400';
$date_order = date("Y-m-d");
mysql_query("INSERT INTO productorder VALUES (NULL,'$member_id', '$name', '$address', '$total_price','$date_order')") or die (mysql_error());
$getOrder = mysql_query("SELECT order_id FROM productorder WHERE member_id = '$member_id'") or die (mysql_error());
$order_info = mysql_fetch_array($getOrder, MYSQL_NUM);
$getTransaction = mysql_query("SELECT * FROM transaction WHERE member_id = '$member_id'") or die (mysql_error());
$transaction_info = mysql_fetch_array($getTransaction, MYSQL_NUM);
while($detail = mysql_fetch_array($transaction_info, MYSQL_NUM)){
mysql_query("INSERT INTO detailorder VALUES(NULL,'$order_info[0]','$detail[product_code]','$detail[quantity]','$detail[price]')")or die (mysql_error());
}
//$delete_transaction = mysql_query("DELETE FROM transaction WHERE member_id = '$member_id'") or die (mysql_error());
echo "DELETED.";
mysql_close($link);
?>
请编辑代码给我
我测试它。响应错误 mysql_fetch_array() 期望参数 1 是资源,给定的数组。
android 将值设置为 php 1.insert 到 productorder 2.select order_id(auto_increment) from productorder 2.1 请检查语法是 $order_info 3.select * from transaction 3.1 请检查语法是 $transaction_info 4.insert 2.1,2.2 到 detailorder