我將數據插入到我的數據庫時沒有問題。 我得到這個錯誤,但我不知道的方式。我有其他腳本幾乎相同的查詢,它工作正常,但這不是。我檢查在鉻檢查員POST數據顯示罰款。PHP - MYSQL - SQLSTATE [HY093]:無效的參數編號
如果你有什麼想法,請告訴我。 在此先感謝。
$fact_total = (float)$_POST['precio'];
$fact_btax = (float)$_POST['precio_sin'];
$fact_tax = (float)$_POST['impuestos'];
$fact_name = e($_POST['fact_name']);
$fact_tipo = e($_POST['fact_serv']);
$fact_tax_rate = 21;
try{
$handler = $db->prepare('INSERT INTO fact_info
(id_client, cl_name, cl_last_name, cl_last_name_2, cl_email, cl_tel, cl_doc_type, cl_doc, cl_via, cl_street, cl_number, cl_level, cl_stairs, cl_door, cl_provincia, cl_city, cl_cod_postal, fact_urgencia, fact_name, fact_tipo, fact_total, fact_btax, fact_tax, fact_tax_rate, created) VALUES (:id_client, :cl_name, :cl_last_name, :cl_last_name_2, :cl_email, :cl_tel, :cl_doc_type, :cl_doc, :cl_via, :cl_street, :cl_number, :cl_level, :cl_stairs, :cl_door, :cl_provincia, :cl_city, :cl_cod_postal, :fact_urgencia, :fact_name, :fact_tipo, :fact_total, :fact_btax, :fact_tax, :pres_tax_rate, NOW())');
$handler->execute(array(
':id_client' => $client_ids,
':cl_name' => e($_POST['fact_cl_name']),
':cl_last_name' => e($_POST['fact_lastname']),
':cl_last_name_2' => e($_POST['fact_lastname_2']),
':cl_email' => e($_POST['fact_email']),
':cl_tel' => e($_POST['fact_tel']),
':cl_doc_type' => e($_POST['fact_document_type']),
':cl_doc' => e($_POST['fact_document_number']),
':cl_via' => e($_POST['fact_dir_via']),
':cl_street' => e($_POST['fact_dir_calle']),
':cl_number' => (int)$_POST['fact_dir_number'],
':cl_level' => e($_POST['fact_dir_level']),
':cl_stairs' => e($_POST['fact_dir_stairs']),
':cl_door' => e($_POST['fact_dir_door']),
':cl_provincia' => e($_POST['fact_dir_provincia']),
':cl_city' => e($_POST['fact_dir_localidad']),
':cl_cod_postal' => (int)$_POST['fact_dir_cod_postal'],
':fact_urgencia' => '1',
':fact_name' => $fact_name,
':fact_tipo' => $fact_tipo,
':fact_total' => $fact_total,
':fact_btax' => $fact_btax,
':fact_tax' => $fact_tax,
':fact_tax_rate' => $fact_tax_rate
));
$fact_id = $db->lastInsertId();
foreach ($_POST['inv_desc'] as $key => $value) {
$handler4 = $db->prepare('INSERT INTO fact_content (id_fact, fact_desc, fact_qty, fact_price, fact_subtotal) VALUES (:id_fact, :fact_desc, :fact_qty, :fact_price, :fact_subtotal)');
$handler4->execute(array(
':id_fact' => $fact_id,
':fact_desc' => e($_POST['inv_desc'][$key]),
':fact_qty' => (float)$_POST['inv_qty'][$key],
':fact_price' => (float)$_POST['inv_precio'][$key],
':fact_subtotal' => (float)$_POST['inv_subtotal'][$key]
));
}
header('Location: fact_confirm.php?fact_id='.$fact_id.'');
exit();
哪個錯誤? –
它在標題中,但現在解決了。 – abonive
Yeap,我看到它有點晚了.. –