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 

最新文章

  1. FastClick 填坑及源码解析
  2. 2015.10.15night
  3. WinForm------TreeList属性介绍
  4. 慢牛APP相关截图
  5. How to set China Azure Storage Connection String
  6. serialVersionUID要注意以下几点:
  7. 【jqGrid for ASP.NET MVC Documentation】.学习笔记.4.性能
  8. hibernate关于一对一用法
  9. MRI中T1和T2的含义与区分[转]
  10. ActiveMQ之TemporaryQueue和TemporaryTopic
  11. BOM浏览器对象模型和API速查
  12. Django操作数据库
  13. Laravel的console使用方法
  14. 微信小程序(有始有终,全部代码)开发--- 新增【录音】以及UI改进
  15. Coursera-AndrewNg(吴恩达)机器学习笔记——第一周
  16. 决AndroidStudio 安卓模拟器安装在D盘问题
  17. 【动态规划】最大连续子序列和,最大子矩阵和,最大m子段和
  18. Java内存模型-锁的内存语义
  19. Html学习笔记3
  20. 20155315 2016-2017-2《Java程序设计》课程总结

热门文章

  1. ThinkPHP的增、删、改、查
  2. Ubuntu下编译Chromium for Android
  3. Action类为何要 extends ActionSupport
  4. Z-XML团队 软件工程课之我感我思我收获
  5. git学习 本地常用操作01
  6. iOS Simulator功能介绍关于Xamarin IOS开发
  7. SGU326 Perspective(指派问题)
  8. AppCache 离线存储 应用程序缓存 API 及注意事项
  9. 常用移动web开发框架研究分析
  10. Nginx location 匹配规则