Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $hostname = "localhost";
- $username = "mysql_user";
- $password = "mycorrectpass";
- $database = "database";
- $con = mysql_connect($hostname, $username, $password) or die('x');
- $db = mysql_select_db($database, $con) ;
- function dbq($sql , $assoc = false) {
- $result = mysql_query($sql);
- if ($assoc == true) {
- while ($row = mysql_fetch_assoc($result)) {
- $return[] = $row;
- }
- } else {
- while ($row = mysql_fetch_array($result)) {
- $return[] = $row;
- }
- }
- return $return;
- }
- function db_getVal($sql) {
- $result = mysql_query($sql) or die$sql);
- $row = mysql_fetch_array($result);
- return $row[0];
- }
- $a = dbq("select distinct site_week from sites where site_week > 0");
- foreach ($a as $arr) {
- $site_week[] = $arr['site_week'];
- $type1[] = db_getVal("select count(*) from sites where site_week = {$site_week} and site_fab='Motorola'");
- $type2[] = db_getVal("select count(*) from sites where site_week = {$site_week} and site_fab='Alcatel'");
- }
- $MyData->addPoints($site_week,"Weeks");
- $MyData->addPoints($type1[],"Motorola");
- $MyData->addPoints($type2[],"Alcatel");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement