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 

mysqli_multi_query($link, $wsql)的更多相关文章

  1. angular 自定义指令 link

    function link(scope, element, attrs) { ... } where: scope is an Angular scope object. element is the ...

  2. oracle的db link

    cd $ORACLE_HOME/network/admin vi tnsnames.ora 添加 CCPBS_19 =  (DESCRIPTION =    (ADDRESS_LIST =      ...

  3. 动态加载script 和 link

    1.script EventUtil.addHandler(window, "load", function(event){ var script = document.creat ...

  4. Difference between a Hard Link and Soft (Symbolic) Link

    Within the Unix/Linux file system, linking lets you create file shortcuts to link one or more files. ...

  5. VS2013的 Browser Link 引起的问题

    环境:vs2013 问题:在调用一个WebApi的时候出现了错误: 于是我用Fiddler 4直接调用这个WebApi,状态码是200(正常的),JSon里却提示在位置9409处文本非法, 以Text ...

  6. ORACLE "ORA--22992:无法使用远程表选择的LOB定位器,database link"

    解决办法:    先创建一个临时表,然后把远程的含CLOB字段的表导入到临时表中,再倒入本表. create global temporary table demo_temp as select * ...

  7. angularjs compile和link

    原文:http://www.cnblogs.com/GoodPingGe/p/4361354.html ************************************************ ...

  8. oracle 创建database Link

    当两台不同的数据库服务器想要共享一部分数据的时候,可以通过创建database Link的方式实现. 创建全局database links ,则必须使用systm或sys用户,在database前加p ...

  9. AngularJs自定义指令详解(5) - link

    在指令中操作DOM,我们需要link参数,这参数要求声明一个函数,称之为链接函数. 写法: link: function(scope, element, attrs) { // 在这里操作DOM} 如 ...

随机推荐

  1. [译] Web API 之 简介

    事实上,MVC 框架本身已经提供了构建REST风格服务的基础,而Web API 只是让你可以更加容易和快捷的构建REST服务. 特性 基于约定的 CRUD Actions: 自动按照HTTP的acto ...

  2. POJ 2482 Stars in Your Window 线段树扫描线

    Stars in Your Window   Description Fleeting time does not blur my memory of you. Can it really be 4 ...

  3. 【HTML5】Application Cache应用程序缓存

    HTML5 引入了应用程序缓存,这意味着 web 应用可进行缓存,并可在没有因特网连接时进行访问. 应用程序缓存为应用带来三个优势: 离线浏览 - 用户可在应用离线时使用它们 速度 - 已缓存资源加载 ...

  4. Let the Balloon Rise

    Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...

  5. 2016 Multi-University Training Contest 7

    6/12 2016 Multi-University Training Contest 7 期望 B Balls and Boxes(BH) 题意: n个球放到m个盒子里,xi表示第i个盒子里的球的数 ...

  6. 模拟 CSU 1562 Fun House

    题目传送门 /* 题意:光线从 '*' 发射,遇到 '/' 或 '\' 进行反射,最后射到墙上,将 'x' 变成 '&' 模拟:仔细读题,搞清楚要做什么,就是i,j的移动,直到撞到墙,模拟一下 ...

  7. POJ1325 Machine Schedule(二分图最小点覆盖集)

    最小点覆盖集就是在一个有向图中选出最少的点集,使其覆盖所有的边. 二分图最小点覆盖集=二分图最大匹配(二分图最大边独立集) 这题A机器的n种模式作为X部的点,B机器的m种模式作为Y部的点: 每个任务就 ...

  8. Machine Schedule

    Machine Schedule Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  9. NOI2010 : 超级钢琴

    求出前缀和 对于每个结尾i,设现在取的区间是[j+1,i],则i-R<=j<=i-L,取出该区间sum[j]的最小值,将sum[i]-sum[j]放入堆中 建立一个大根堆,每次取出堆顶元素 ...

  10. HDU 1312 (BFS搜索模板题)

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1312 题目大意:问迷宫中有多少个点被访问. 解题思路: DFS肯定能水过去的.这里就拍了一下BFS. ...