Идентификатор данных заголовка будет использоваться при вставке нескольких строк различных данных в таблицу деталей. Я использую «Many Man» из этой ссылки в качестве ссылки: https://www.myphptutoriors.com/tutorials/print-154
Я получаю ошибку при сохранении данных:
. Строка 104 < /p>
< /blockquote>
Все строки и т. Д. < /p>
Код: Выделить всё
// header
$resultExec1 = mysqli_query($db, "insert into header " .
"(user_id,
buyer,
test1,
trxid,
total
) " .
"VALUES ('" . $_SESSION['id'] . "', " .
"'" . $_POST['buyer'] . "', " .
"'" . $_POST['test1'] . "', " .
"'" . $_POST['trxid'] . "', " .
"'" . $_POST['total1'] . "')");
$query1 = mysqli_query($db, "SELECT max(Alt_Id) AS id_header FROM detail limit 1");
$data = mysqli_fetch_array($query1);
$id_agens = $data['id_header'];
foreach($_POST['country1'] as $key => $ctry){
$country1 = $ctry;
$resultExec2 = mysqli_query($db,
"insert into detail " .
"(user_id,
test1,
id_header,
test2,
test21,
test22,
test3,
test31,
test32,
test4,
test41,
test42) " .
"VALUES ('" . $_SESSION['id'] . "', " .
"'" . $ctry . "', " .
"'" . $id_header. "', " .
"'" . $_POST['test2'][$key] . "', " .
"'" . $_POST['test21'][$key] . "', " .
"'" . $_POST['test22'][$key] . "', " .
"'" . $_POST['test3'][$key] . "', " .
"'" . $_POST['test31'][$key] . "', " .
"'" . $_POST['test32'][$key] . "', " .
"'" . $_POST['test4'][$key] . "', " .
"'" . $_POST['test41'][$key] . "', " .
"'" . $_POST['test42'][$key] . "')");}
Подробнее здесь: https://stackoverflow.com/questions/795 ... -header-an