$num_clicks = $r['raws'] + $r['uniques'] + $r['signups'] + $r['sales_number']; } mysql_data_seek($rs_stats, 0); switch ($flag) { case 0: echo sprintf("%d clickout(s) there. %d click(s) in stats there.\n", $num_clickouts, $num_clicks); break; case 1: if ($num_clickouts < $num_clicks) { $abn++; echo sprintf("abnormal: %d clickout(s) there. %d click(s) in stats there.\n", $num_clickouts, $num_clicks); } break; case 2: if ($num_clickouts < $num_clicks) { $abn++; echo sprintf("abnormal: %d clickout(s) there. %d click(s) in stats there.\n", $num_clickouts, $num_clicks); /* * then we show the deatils below */ include_once 'datagrid.class.php'; $grid_clickouts = new dataGrid($rs_clickouts, "", array(0 => "companyid", 1 => "officename", 2 => "agentid", 3 => "username", 4 => "clicktime", 5 => "ny_clicktime", 6 => "fromip", 7 => "referer", 8 => "siteid", 9 => "sitename", 10 => "typeid", 11 => "typename", 12 => "url"), '', '', '#cccddd', 600); $grid_clicks = new dataGrid($rs_stats, "", array(0 => "trxtime", 1 => "companyid", 2 => "officename", 3 => "agentid", 4 => "username", 5 => "siteid", 6 => "sitename", 7 => "typeid", 8 => "typename", 9 => "price", 10 => "earning", 11 => "raws", 12 => "uniques", 13 => "chargebacks", 14 => "signups", 15 => "frauds", 16 => "sales_number", 17 => "net", 18 => "payouts", 19 => "earnings"), '', '', '#dddeee', 800); $grid_clickouts->create(); $grid_clicks->create(); echo "\n"; } break; } } echo "(abnormal)" . $abn . "/(total)" . count($agent_sites) . "\n";
<html> <head> <title>Sample code</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php include "datagrid.class.php"; // $link = mysql_connect($host, $user, $pass); mysql_select_db($dbName, $link); $users = mysql_query("SELECT userID, username, password, email, tel, fax FROM users"); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // signature : dataGrid($dataSource, $dataKeyField, $fieldsToShow, $nextPage, $nextPageLable, $rowColor, $width) // $dataSource=$users; // $dataKeyField(Promary key)="userID"; // $fieldsToShow(Array of columns names)=array(0=>"username", 1=>"webSite", 2=>"password", 3=>"email"); // it means that just username, password and email columns will be shown in the grid. // $nextPage(Page you want to do some action on selected row element.)=activateUsers.php; // $nextPageLable(Label to be shown in dataGrid)="Activate this User"; // $rowColor="#eeeeee"; // $width="600";Pixels ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $g = new dataGrid($dataSource, "userID", array(0 => "username", 1 => "webSite", 2 => "password", 3 => "email"), "activateUsers.php", "Activate this User", "#eeeeee", "600"); $g->create(); //Shown the grid. ?> </body> </html>