Urgent! Online help! There is such a demand. Collect store-related data by time. The data in the database is transmitted twice a day. An accumulation is required.
The final result table is displayed.
The first column name is the name of the database column.
Network Fee income = network fee income
Member income = member income
Commodity income = commodity income
Card income = card income
Total = total consumption of temporary cards
Network fee single-host = (network fee revenue + member income)/number of machines in the corresponding store name column in dmmc (table.
Single Product = number of machines in the corresponding store name column in the product revenue/dmmc (table.
Single-host card distribution = number of machines of the corresponding name in the node/dmmc (table) column.
Total is the sum of corresponding columns.
The average daily value is after the corresponding column addition/day
Take a store database table as an example.
Dmmc table
Please code !!
Reply to discussion (solution)
Upload the second image again. Take the 11.1 data as the standard.
The image cannot be seen. if daily summary is used, the linux scheduled task and the php command line can be used to pass the parameter. is the sum true if it is not the select sum (field?
The image cannot be seen. if daily summary is used, the linux scheduled task and the php command line can be used to pass the parameter. is the sum true if it is not the select sum (field?
Can you add qq to ask you a few questions?
$ Result = mysql_query ("SELECT date, network fee income, member income, product Income, point card income, network fee income + member Income + product Income + point card income AS total FROM ". $ data. "", $ link );
In SQL, you can read the number at the top of each row. the fifth column is used to calculate the sum. it can be found in the mysql queryer, but there is no data on the webpage. If the values of the four columns are removed, they can be obtained... Really depressing
Did you retrieve the total field when you retrieve data on the webpage? Or is there only the first five fields?
Store business query results
\ N "; echo"\ N "; while ($ field = mysql_fetch_field ($ result) {echo"". $ Field-> name ."\ N "; $ str = $ str. $ field-> name. "," ;}// generate a new query field $ length = strlen ($ str); $ sumstr = substr ($ str, 0, $ length-1 ); echo $ sumstr; echo"\ N "; mysql_free_result ($ result); $ result = mysql_query (" SELECT $ sumstr FROM $ data where date between '$ top' and '$ end' ", $ link ); while ($ row = mysql_fetch_row ($ result) {echo"\ N "; for ($ I = 0; $ I
". $ Row [$ I]."";} Echo"\ N ";} echo"\ N "; mysql_free_result ($ result); mysql_close ($ link);?>
Did you retrieve the total field when you retrieve data on the webpage? Or is there only the first five fields?
I posted the code. I can find it when I put it in the queryer.
In the code, if the sum of the four columns is not used. The numbers of the four columns in the middle can also be printed in a web table. The problem is that when I add these four numbers, no data is available. So I pasted the code.
What are your first four columns ?? All already? The sum of the columns is found? Face? Shown? Hou ,? What? Not directly put? After adding the values of the four columns? Display
All are Chinese fields ,,,,?
While ($ field = mysql_fetch_field ($ result) {echo"". $ Field-> name ."\ N "; $ str = $ str. $ field-> name.", ";}// use mysql_fetch_row () to print $ field and check whether there is any data.
All are Chinese fields ,,,,?
While ($ field = mysql_fetch_field ($ result) {echo"". $ Field-> name ."\ N "; $ str = $ str. $ field-> name.", ";}// use mysql_fetch_row () to print $ field and check whether there is any data.
The page does not appear.
You have a headache...
Give you a thought... first, check the data and change the array.
Then perform operations based on your table traversal array...
Select ("bp_testloglist", "testEndtime", "order by testEndtime desc limit 0, 1"); if ($ row = $ db-> fetch_array ($ query )) {$ lastUpdateint = $ row ['0'] + 54000;} unset ($ query); unset ($ row ); $ lastUpdatedayint = strtotime (date ("Y-m-d", $ lastUpdateint )); // replace the value with the start time of the current day based on the dell Time. // convert the value from the last time of the Test record to the abc time $ queryDateint = $ lastUpdatedayint-6*24*60*60-54000; // obtain the test time for the last 2 days $ queryDateint2 = $ lastUpdatedayint-24*60*6 0-54000; $ querDateabc2int = $ queryDateint2 + 54000; // Obtain the Performance of the test site $ query = $ db-> select ("bp_testloglist", "testStation, testResult, testEndtime "," where testEndtime >=$ queryDateint and testDatabase = 0 "); while ($ row = $ db-> fetch_array ($ query )) {$ stationSummary [dellToabcdayint ($ row ['2'])] [$ row ['0'] [$ row ['1'] = $ stationSummary [dellToabcdayint ($ row ['2'])] [$ row ['0'] [$ row ['1'] + 1;} unset ($ query); uns Et ($ row); $ m_Testhate = $ m_Testhate + 24*60*60; // obtain the test site name $ query = $ db-> query ("select. testerFullname,. testerID,. testerType, B. stationNamelite,. testerName, INET_NTOA (. testerIP) from bp_tester as a left join bp_teststation as B on. testerType = B. stationID where. testerShow = 1 order by. testerType, testerFullname asc "); while ($ row = $ db-> fetch_array ($ query) {$ testType [$ row ['2'] = $ row ['3 ']; $ TesterHost [$ row ['1'] = array ('testerhost' => $ row [4], 'testerip' => $ row ['5'], 'testerstation' => $ row ['3']); $ testerName [$ row ['1'] = $ row ['0']; $ I ++;} unset ($ query); unset ($ row ); $ currentTime = date ("Y-m-d H: I: s"); include_once '. /include/system. top. php '; include_once '. /include/system. menu. php ';?>
[Test Station Performance] _ UPDATE :[
]
Tester/Date | ". Date (" Y-m-d ", $ )."". Date (" l ", $ ).""; $ I ++;} unset ($ a);?>
T |
P |
F |
A |
$ Value1) {$ testerID = $ key;?>
Host name: ". $ value1 ['testerhost'];?> "> |
| 0? @ $ TotalPass [$ value]: @ $ totalPass [$ value] = 0; @ $ totalFail [$ value]> 0? @ $ TotalFail [$ value]: @ $ totalFail [$ value] = 0; @ $ totalAbort [$ value]> 0? @ $ TotalAbort [$ value]: @ $ totalAbort [$ value] = 0; @ $ totalTotal [$ value]> 0? @ $ TotalTotal [$ value]: @ $ totalTotal [$ value] = 0; if (arrayValue ($ stationSummary, $ value )) {if (arrayValue ($ stationSummary [$ value], $ testerID) {$ tPass = (int) arrayValue ($ stationSummary [$ value] [$ testerID], '3'); $ tFail = (int) arrayValue ($ stationSummary [$ value] [$ testerID], '1'); $ tAbort = (int) arrayValue ($ stationSummary [$ value] [$ testerID], '2'); $ tTotal = $ tPass + $ tFail + $ tAbort; $ totalPass [$ value] = $ totalPass [$ value] + $ tPass; $ totalFail [$ value] = $ totalFail [$ value] + $ tFail; $ totalAbort [$ value] = $ totalAbort [$ value] + $ tAbort; $ totalTotal [$ value] = $ totalTotal [$ value] + $ tTotal ;} else {$ tPass = 0; $ tFail = 0; $ tAbort = 0; $ tTotal = $ tPass + $ tFail + $ tAbort; $ totalPass [$ value] = $ totalPass [$ value] + $ tPass; $ totalFail [$ value] = $ totalFail [$ value] + $ tFail; $ totalAbort [$ value] = $ totalAbort [$ value] + $ tAbort; $ totalTotal [$ value] = $ totalTotal [$ value] + $ tTotal ;}} else {$ tPass = 0; $ tFail = 0; $ tAbort = 0; $ tTotal = $ tPass + $ tFail + $ tAbort; $ totalPass [$ value] = $ totalPass [$ value] + $ tPass; $ totalFail [$ value] = $ totalFail [$ value] + $ tFail; $ totalAbort [$ value] = $ totalAbort [$ value] + $ tAbort; $ totalTotal [$ value] = $ totalTotal [$ value] + $ tTotal ;} if ($ tTotal <> 0) {echo"
$ TTotal | ";} Else {echo"
| ";} If ($ tPass <> 0) {echo"
$ TPass | ";} Else {echo"
| ";} If ($ tFail <> 0) {echo"
$ TFail | ";} Else {echo"
| ";} If ($ tAbort <> 0) {echo"
$ TAbort | ";} Else {echo"
| ";}}?>
Total | 0) {echo"
$ TotalTotal [$ value] | ";} Else {echo"
| ";} If ($ totalPass [$ value] <> 0) {echo"
$ TotalPass [$ value] | ";} Else {echo"
| ";} If ($ totalFail [$ value] <> 0) {echo"
$ TotalFail [$ value]";} Else {echo" |
| ";} If ($ totalAbort [$ value] <> 0) {echo"
$ TotalAbort [$ value] | ";} Else {echo"
| ";}}$ TotalTotal = NULL; $ totalPass = NULL; $ totalFail = NULL; $ totalAbort = NULL;?>
This is what it looks like.