How many orders can I find in PHP? Why can't I do this ?? $ Order_id = mysql_query (& quot; selectorder_idfrommyr_orderwhere '& quot ;. strtotime ('-'. $ date. 'day '). & quot; '& lt; = add _ PHP
How many orders can I meet? Why can't I do this ??
$ Order_id = mysql_query ("select order_id from myr_order where '". strtotime ('-'. $ date. 'day '). "'<= add_time and add_time <= '". mktime (). "'");
While ($ t_id = mysql_fetch_array ($ order_id, MYSQL_ASSOC )){
$ Is_in = 1;
$ Num = 0;
$ Que = mysql_query ("select goods_sn, order_id from myr_order_goods where order_id = '". $ t_id ['Order _ id']. "'");
While ($ gs = mysql_fetch_object ($ que )){
If (in_array ($ gs-> goods_sn, $ sn) & $ is_in = 1 ){
$ Is_in = 1;
} Elseif (in_array ($ gs-> goods_sn, $ sn) & $ is_in = 0 ){
$ Is_in = 0;
Break;
}
}
If ($ is_in = 1 ){
$ Num = $ num + 1;
} Elseif ($ is_in = 0 ){
Continue;
}
}
Echo $ num;
------ Solution --------------------
PHP code
$ SQL = "select order_id from myr_order where '". strtotime ('-'. $ date. 'day '). "'<= add_time and add_time <= '". mktime (). "'"; $ order_id = mysql_query ($ SQL); $ num = 0; // put it out to try while ($ t_id = mysql_fetch_array ($ order_id, MYSQL_ASSOC )) {$ is_in = 1; $ que = mysql_query ("select goods_sn, order_id from myr_order_goods where order_id = '". $ t_id ['Order _ id']. "'"); $ gs = mysql_fetch_object ($ que); if (in_array ($ gs-> g Oods_sn, $ sn) & $ is_in) {$ is_in = 1;} elseif (in_array ($ gs-> goods_sn, $ sn )&&! $ Is_in) {$ is_in = 0; break;} if ($ is_in) {$ num = $ num + 1;} elseif (! $ Is_ I) {continue;} echo $ num;