Evaluate the value-php Tutorial

Source: Internet
Author: User
Evaluate the effect: lazygc520 is used to edit the image at the end of this post from 2013-06-2817: 35: 24 as follows: can the effect be achieved? for example, when the total number is 240, the first cell in purple is 120, and the second cell is 240-120120. The relationship in the figure is as follows: one stockno corresponds to multiple rows, and the figure shows two rows. If a page corresponds to multiple stockno instances, evaluate the value of co corresponding to $ arrs.

This post was last edited by lazygc520 at 17:35:24

The image is as follows:


For example, when the total number is 240, the first cell in purple is 120, and the second cell is 240-120 = 120.
The relationship in the figure is as follows:

One stockno corresponds to multiple rows, and the figure shows two rows. If a page corresponds to multiple stockno instances, the total number of accounts corresponding to $ arrs removes the count value assigned to the first stockno, the remaining values are assigned to the values in the purple box corresponding to stockno.

The code is as follows:

$ SQL = "select DISTINCT B. packageno,. stock_no from 'stock _ detail 'as a, 'kw _ manage' as B where. stock_no = '". $ stockno [$ j-1]. "'and. cust_no = replace (B. cust_no ,'','')";
// Echo $ SQL .'
';
$ Result = mysql_query ($ SQL );
$ Res = array ();
While ($ row = mysql_fetch_array ($ result, MYSQL_ASSOC ))
{
$ Sql2 = "select lotno, count (lotno) from 'VP _ barcode_2d_y 'where packageno = '". $ row ['packageno']. "'group by lotno, packageno order by lotno asc ";
// Echo $ sql2 .'
';
$ Result2 = mysql_query ($ sql2 );
$ Var = array ();
While ($ row2 = mysql_fetch_array ($ result2, MYSQL_NUM ))
{
If (isset ($ res [$ row2 [0])
$ Res [$ row2 [0] ['count'] + = $ row2 [1];
Else
$ Res [$ row2 [0] = array ('lotno' => $ row2 [0], 'count' => $ row2 [1]);
}
}
Ksort ($ res );
$ Arrs = array ();
Foreach ($ res as $ v2)
{
$ Arrs [] = $ v2;
}
Print_r ($ arrs); // Array ([0] => Array ([lotno] => 3207 [count] => 240 ))


$ Sql4 = "select arr_time, c_type, cust_no, snp, mount, mount * snp as m_total from '". $ t. "'Where stock_no = '". $ stockno [$ j-1]. "'";
$ Result4 = mysql_query ($ sql4 );
$ A = array ();
While ($ var = mysql_fetch_array ($ result4, MYSQL_NUM ))
{
$ A [] = $ var;
}
Foreach ($ a as $ k => $ v) // display the result of two rows corresponding to a stockno
{
Echo'


'. ($ K + 1 ).'';
?>

Echo $ v ['0'];
?>

Echo $ v ['1'];
?>

Echo $ v ['2'];
?>

$ SQL = "select type from 'kw _ info' where cust_no = '". $ v ['2']. "'";
$ Result = mysql_query ($ SQL );
$ Row = mysql_fetch_array ($ result, MYSQL_ASSOC );
Echo $ row ['type'];

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.