mysqli_multi_query($link, $wsql)
2024-09-25 04:13:33
if (mysqli_multi_query($link, $wsql)) {
do {
if ($result = mysqli_store_result($link)) {
mysqli_free_result($result);
}
} while (mysqli_more_results($link) && mysqli_next_result($link));
}
<?php
echo phpinfo();
function w_db_in_w($link, $fk_countrycode, $fk_categoryid, $wmax_grab_date, $wmin_grab_date, $year, $week)
{
mysqli_query($link, 'SET group_concat_max_len=8192');
$sql = 'SELECT GROUP_CONCAT(amzid) AS wsum FROM ( SELECT amzid FROM grab_amz_sales_ranking WHERE countrycode="' . $fk_countrycode . '" AND w_categoryid=' . $fk_categoryid . ' AND grab_amz_date>=' . $wmin_grab_date . ' AND grab_amz_date<=' . $wmax_grab_date . ' AND grab_page_rank<101 ORDER BY w_sale DESC LIMIT 100 ) AS w192'; $w_amzidlist = db_single_row_single_field_link($link, $sql, 'wsum'); if (!empty($w_amzidlist)) {
$sql = 'INSERT INTO sales ranking_week (history_year,history_week,fk_countrycode,fk_categoryid,amzidlist100_amzids) VALUES ( ' . $year . ',' . $week . ',"' . $fk_countrycode . '",' . $fk_categoryid . ',"' . $w_amzidlist . ' ");';
$w_id = gen_this_insert_id_link($sql, $link);
$wkey = 'sales ranking_week_id';
$sql = 'SELECT SUM(w_sale) AS wsum FROM ( SELECT w_sale FROM grab_amz_sales_ranking WHERE countrycode="' . $fk_countrycode . '" AND w_categoryid=' . $fk_categoryid . ' AND grab_amz_date>=' . $wmin_grab_date . ' AND grab_amz_date<=' . $wmax_grab_date . ') AS w';
$w_amount_all = db_single_row_single_field_link($link, $sql, 'wsum');
$wsql = 'UPDATE sales ranking_week SET amount_all = ' . $w_amount_all . ' WHERE ' . $wkey . '=' . $w_id . ';';
if ($w_amount_all > 0) {
for ($w = 100; $w >= 10; $w = $w - 10) {
$sql = 'SELECT SUM(w_sale) AS wsum FROM ( SELECT w_sale FROM grab_amz_sales_ranking WHERE countrycode="' . $fk_countrycode . '" AND w_categoryid=' . $fk_categoryid . ' AND grab_amz_date>=' . $wmin_grab_date . ' AND grab_amz_date<=' . $wmax_grab_date . ' AND grab_page_rank<' . ($w + 1) . ' ORDER BY w_sale DESC LIMIT ' . $w . ') AS w';
$w_res = db_single_row_single_field_link($link, $sql, 'wsum');
$wsql .= 'UPDATE sales ranking_week SET amount_' . $w . ' = ' . $w_res . ' WHERE ' . $wkey . '=' . $w_id . ';';
}
}
/*
* mysqli_multi_query($link,$wsql);
* WRONG
* 2016-12-20 15:49:01
PHP Version 5.3.29
* */
//
if (mysqli_multi_query($link, $wsql)) {
do {
if ($result = mysqli_store_result($link)) {
mysqli_free_result($result);
}
} while (mysqli_next_result($link));
}
}
}
Strict Standards: mysqli_next_result() [function.mysqli-next-result]: There is no next result set. Please, call mysqli_more_results()/mysqli::more_results() to check whether to call this function/method
最新文章
- FastClick 填坑及源码解析
- 2015.10.15night
- WinForm------TreeList属性介绍
- 慢牛APP相关截图
- How to set China Azure Storage Connection String
- serialVersionUID要注意以下几点:
- 【jqGrid for ASP.NET MVC Documentation】.学习笔记.4.性能
- hibernate关于一对一用法
- MRI中T1和T2的含义与区分[转]
- ActiveMQ之TemporaryQueue和TemporaryTopic
- BOM浏览器对象模型和API速查
- Django操作数据库
- Laravel的console使用方法
- 微信小程序(有始有终,全部代码)开发--- 新增【录音】以及UI改进
- Coursera-AndrewNg(吴恩达)机器学习笔记——第一周
- 决AndroidStudio 安卓模拟器安装在D盘问题
- 【动态规划】最大连续子序列和,最大子矩阵和,最大m子段和
- Java内存模型-锁的内存语义
- Html学习笔记3
- 20155315 2016-2017-2《Java程序设计》课程总结