本文整理汇总了PHP中functions::data_insert方法的典型用法代码示例。如果您正苦于以下问题:PHP functions::data_insert方法的具体用法?PHP functions::data_insert怎么用?PHP functions::data_insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类functions
的用法示例。
在下文中一共展示了functions::data_insert方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: VALUES
$cart_count = $_SESSION['cart_count'];
$increment = 1;
$sql1 = "SELECT CUSTOMER_NUMBER PRODUCT_CODE FROM customer_cart WHERE PRODUCT_CODE =" . $prod_code . " AND CUSTOMER_NUMBER=" . $cust_id;
$result1 = $con->data_select($sql1);
$sql2 = "SELECT ID, PACKAGING_CODE, OPERAND, ACCOUNT_NUMBER, PRODUCT_CODE FROM xxdkapps_price_list_master WHERE PACKAGING_CODE LIKE '%" . $pkgsize . "' AND ACCOUNT_NUMBER = '" . $cust_id . "' AND PRODUCT_CODE = '" . $prod_code . "' ORDER BY ID DESC LIMIT 1";
$result2 = $con->data_select($sql2);
if ($result2 != "no") {
$price = $result2[0]['OPERAND'];
} else {
$price = 0.0;
}
if ($result1 != "no") {
echo "Product already in the Cart";
} else {
$sql = "INSERT INTO customer_cart (CUSTOMER_NUMBER, PRODUCT_CODE, ITEM_DESCRIPTION, PACKAGING_SIZE, QUANTITY, AVAILABLE_PRICE, REMARK) VALUES ({$cust_id},{$prod_code},'{$prod_desc}','{$pkgsize}','{$qty}','{$price}','{$remark}')";
$result = $con->data_insert($sql);
$_SESSION['cart_count'] = $cart_count + $increment;
echo $_SESSION['cart_count'];
}
}
if (isset($_REQUEST['action']) && $_REQUEST['action'] == "removecart") {
$prod_code = $_REQUEST['prod_code'];
$cust_id = $_SESSION['cust_id'];
$cart_count = $_SESSION['cart_count'];
$increment = 1;
$sql = "DELETE FROM customer_cart WHERE PRODUCT_CODE =" . $prod_code . " AND CUSTOMER_NUMBER =" . $cust_id;
$result = $con->data_delete($sql);
$_SESSION['cart_count'] = $cart_count - $increment;
echo $_SESSION['cart_count'];
}
if (isset($_REQUEST['action']) && $_REQUEST['action'] == "updatecart") {
示例2: foreach
$data[$i] = $row;
$i++;
}
/*echo "<pre>";
print_r($data);
exit;*/
foreach ($data as $key => $value) {
$order_status = "";
if ($data[$key]['ORDER_STATUS'] == "CLOSED") {
$order_status = "DESPATCH";
$sql = "INSERT INTO logistic_view(CUST_PO_NUMBER, CUSTOMER_NUM, ORG_ID, FREIGHT_TERMS_CODE, SHIPPED_QUANTITY, DELIVERY_ID, DESCRIPTION, INVOICE_NUMBER, PORT_OF_DISCHARGE, SHIPPING_STATUS, SHIPPING_VALUE_INR, ORDER_STATUS, DELIVERY_DETAIL_ID, REQUIRE_DATE_DESTINATION, HEADER_LUD, LINE_LUD, WSH_LUD, WDD_LUD, WND_LUD, EMP_LUD, EML_LUD, JAI_LUD,REF_INV,SHIPPING_VALUE,CURRENCY,DISPATCH_DATE) VALUES ('" . $data[$key]['CUST_PO_NUMBER'] . "','" . $data[$key]['CUSTOMER_NUM'] . "','" . $data[$key]['ORG_ID'] . "','" . $data[$key]['FREIGHT_TERMS_CODE'] . "','" . $data[$key]['SHIPPED_QUANTITY'] . "','" . $data[$key]['DELIVERY_ID'] . "','" . $data[$key]['DESCRIPTION'] . "','" . $data[$key]['INVOICE_NUMBER'] . "','" . $data[$key]['PORT_OF_DISCHARGE'] . "','" . $data[$key]['SHIPPING_STATUS'] . "','" . $data[$key]['SHIPPING_VALUE_INR'] . "','" . $order_status . "','" . $data[$key]['DELIVERY_DETAIL_ID'] . "','" . $data[$key]['REQUIRE_DATE_DESTINATION'] . "','" . $data[$key]['HEADER_LUD'] . "','" . $data[$key]['LINE_LUD'] . "','" . $data[$key]['WSH_LUD'] . "','" . $data[$key]['WDD_LUD'] . "','" . $data[$key]['WND_LUD'] . "','" . $data[$key]['EMP_LUD'] . "','" . $data[$key]['EML_LUD'] . "','" . $data[$key]['JAI_LUD'] . "','" . $data[$key]['REF_INV'] . "','" . $data[$key]['SHIPPING_VALUE'] . "','" . $data[$key]['CURRENCY'] . "','" . $data[$key]['DISPATCH_DATE'] . "')";
} else {
$order_status = $data[$key]['ORDER_STATUS'];
$sql = "INSERT INTO logistic_view(CUST_PO_NUMBER, CUSTOMER_NUM, ORG_ID, FREIGHT_TERMS_CODE, SHIPPED_QUANTITY, DELIVERY_ID, DESCRIPTION, INVOICE_NUMBER, PORT_OF_DISCHARGE, SHIPPING_STATUS, SHIPPING_VALUE_INR, ORDER_STATUS, DELIVERY_DETAIL_ID, REQUIRE_DATE_DESTINATION, HEADER_LUD, LINE_LUD, WSH_LUD, WDD_LUD, WND_LUD, EMP_LUD, EML_LUD, JAI_LUD,REF_INV,SHIPPING_VALUE,CURRENCY,DISPATCH_DATE) VALUES ('" . $data[$key]['CUST_PO_NUMBER'] . "','" . $data[$key]['CUSTOMER_NUM'] . "','" . $data[$key]['ORG_ID'] . "','" . $data[$key]['FREIGHT_TERMS_CODE'] . "','" . $data[$key]['SHIPPED_QUANTITY'] . "','" . $data[$key]['DELIVERY_ID'] . "','" . $data[$key]['DESCRIPTION'] . "','" . $data[$key]['INVOICE_NUMBER'] . "','" . $data[$key]['PORT_OF_DISCHARGE'] . "','" . $data[$key]['SHIPPING_STATUS'] . "','" . $data[$key]['SHIPPING_VALUE_INR'] . "','" . $order_status . "','" . $data[$key]['DELIVERY_DETAIL_ID'] . "','" . $data[$key]['REQUIRE_DATE_DESTINATION'] . "','" . $data[$key]['HEADER_LUD'] . "','" . $data[$key]['LINE_LUD'] . "','" . $data[$key]['WSH_LUD'] . "','" . $data[$key]['WDD_LUD'] . "','" . $data[$key]['WND_LUD'] . "','" . $data[$key]['EMP_LUD'] . "','" . $data[$key]['EML_LUD'] . "','" . $data[$key]['JAI_LUD'] . "','" . $data[$key]['REF_INV'] . "','" . $data[$key]['SHIPPING_VALUE'] . "','" . $data[$key]['CURRENCY'] . "','" . $data[$key]['DISPATCH_DATE'] . "')";
}
$result = $con->data_insert($sql);
}
$getdata_mysql_consignment_details = "SELECT MAX(delivery_details_id) FROM consignment_details";
$result_mysql = $con->data_select($getdata_mysql_consignment_details);
if ($result_mysql != "no") {
$sql = "SELECT CUST_PO_NUMBER, CUSTOMER_NUM, ORG_ID, FREIGHT_TERMS_CODE, SHIPPED_QUANTITY, DELIVERY_ID, DESCRIPTION, INVOICE_NUMBER, PORT_OF_DISCHARGE, SHIPPING_STATUS, SHIPPING_VALUE_INR, ORDER_STATUS, SHIPPED_DATE, DELIVERY_DETAIL_ID, REQUIRE_DATE_DESTINATION, HEADER_LUD, LINE_LUD, WSH_LUD, WDD_LUD, WND_LUD, EMP_LUD, EML_LUD, JAI_LUD,REF_INV,SHIPPING_VALUE,CURRENCY,DISPATCH_DATE\n\t\t FROM logistic_view WHERE DELIVERY_DETAIL_ID > '" . $result_mysql[0]['MAX(delivery_details_id)'] . "'";
$result = $con->data_select($sql);
if ($result != "no") {
foreach ($result as $key => $value) {
$sql_consignment_details = "INSERT INTO consignment_details(cust_po_number,customer_num,org_id,\n\t\t\t \tfreight_terms_code,shipped_quantity,delivery_id,item_description,commercial_invoice,\n\t\t\t \tport_of_discharge,shipping_status,shipping_value_inr,order_status,\n\t\t\t delivery_details_id,require_date,\n\t\t\t Header_lud,line_lud,wsh_lud,wdd_lud,wnd_lud,emp_lud,eml_lud,jai_lud,ref_inv,shipping_value,currency,dispatch_date)\n\t\t\t VALUES ('" . $result[$key]['CUST_PO_NUMBER'] . "','" . $result[$key]['CUSTOMER_NUM'] . "','" . $result[$key]['ORG_ID'] . "',\n\t\t\t \t'" . $result[$key]['FREIGHT_TERMS_CODE'] . "','" . $result[$key]['SHIPPED_QUANTITY'] . "','" . $result[$key]['DELIVERY_ID'] . "'\n\t\t\t \t,'" . $result[$key]['DESCRIPTION'] . "','" . $result[$key]['INVOICE_NUMBER'] . "','" . $result[$key]['PORT_OF_DISCHARGE'] . "',\n\t\t\t \t'" . $result[$key]['SHIPPING_STATUS'] . "','" . $result[$key]['SHIPPING_VALUE_INR'] . "','" . $result[$key]['ORDER_STATUS'] . "',\n\t\t\t \t'" . $result[$key]['DELIVERY_DETAIL_ID'] . "','" . $result[$key]['REQUIRE_DATE_DESTINATION'] . "',\n\t\t\t \t'" . $result[$key]['HEADER_LUD'] . "','" . $result[$key]['LINE_LUD'] . "','" . $result[$key]['WSH_LUD'] . "','" . $result[$key]['WDD_LUD'] . "','" . $result[$key]['WND_LUD'] . "',\n\t\t\t \t'" . $result[$key]['EMP_LUD'] . "','" . $result[$key]['EML_LUD'] . "','" . $result[$key]['JAI_LUD'] . "',\n\t\t\t \t'" . $result[$key]['REF_INV'] . "','" . $result[$key]['SHIPPING_VALUE'] . "','" . $result[$key]['CURRENCY'] . "','" . $result[$key]['DISPATCH_DATE'] . "')";
$result_consignment_details = $con->data_insert($sql_consignment_details);
}
}
} else {
$sql = "SELECT CUST_PO_NUMBER, CUSTOMER_NUM, ORG_ID, FREIGHT_TERMS_CODE, SHIPPED_QUANTITY, DELIVERY_ID, DESCRIPTION, INVOICE_NUMBER, PORT_OF_DISCHARGE, SHIPPING_STATUS, SHIPPING_VALUE_INR, ORDER_STATUS, SHIPPED_DATE, DELIVERY_DETAIL_ID, REQUIRE_DATE_DESTINATION, HEADER_LUD, LINE_LUD, WSH_LUD, WDD_LUD, WND_LUD, EMP_LUD, EML_LUD, JAI_LUD,REF_INV,SHIPPING_VALUE,CURRENCY,DISPATCH_DATE\n\t\t FROM logistic_view";
$result = $con->data_select($sql);
示例3: fopen
}
$query = "SELECT user_id,user_name FROM user_registration";
$result1 = $con->data_select($query);
$_SESSION['success'] = "no";
if (isset($_FILES) && !empty($_FILES)) {
if (is_array($_FILES)) {
if (is_uploaded_file($_FILES['containerdetails']['tmp_name'])) {
$sourcePath = $_FILES['containerdetails']['tmp_name'];
$user = "k";
$targetPath = "uploaded/container" . $user . ".csv";
$i = 0;
if (move_uploaded_file($sourcePath, $targetPath)) {
$file = fopen("uploaded/container" . $user . ".csv", "r");
while (($line = fgetcsv($file)) !== FALSE) {
$sql_insert_product = "INSERT INTO consignment_details(customer_name, account_number, cust_po_number, order_number, ordered_item_id, item_description, unit_selling_price, order_quantity_uom, ordered_quantity, amount, request_date, schedule_ship_date, order_date) VALUES ('" . $line[0] . "','" . $line[1] . "','" . $line[2] . "','" . $line[3] . "','" . $line[4] . "','" . $line[5] . "'," . $line[6] . ",'" . $line[7] . "','" . $line[8] . "','" . $line[9] . "','" . $line[10] . "','" . $line[11] . "','" . $line[12] . "')";
$result2 = $con->data_insert($sql_insert_product);
}
if ($result2 > 0) {
$_SESSION['success'] = "Data has been uploaded!!!!!!";
fclose($file);
}
}
}
}
header("Location:container_details.php");
}
include 'admin_sidebar_header.php';
?>
<!-- page content -->
示例4: functions
$obj = new functions();
$roles[1] = "Admin";
$roles[2] = "Manager";
echo "kudnan";
exit;
date_default_timezone_set('Asia/Kolkata');
$content = "";
if (isset($_REQUEST['action']) && $_REQUEST['action'] != "") {
$user_info_all = explode(",", $_REQUEST['user']);
$i = 1;
foreach ($user_info_all as $key => $values) {
$user_info = explode("-", $user_info_all[$key]);
$sql_duplicate = "select name from user where name='" . $user_info[1] . "' and role !=3 ";
$duplicate = $obj->data_select($sql_duplicate);
if ($duplicate != "no") {
continue;
} else {
$sql_insert = "insert into user(name,email,role,display_name) values ('" . $user_info[1] . "','" . $user_info[0] . "','" . $user_info[20] . "'," . $_REQUEST['role'] . ")";
$res = $obj->data_insert($sql_insert);
$content .= "<tr><td>" . $i . "</td><td>" . $user_info[1] . "</td><td>" . $user_info[0] . "</td><td>" . $roles[$_REQUEST['role']] . "</td></tr>";
$i++;
}
}
if ($content == "") {
$content .= "NO Records has been Added!!!!";
} else {
echo $content;
}
} else {
echo "fail";
}