Jump to content

jankidudel

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jankidudel's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. code translated and attached again [attachment deleted by admin]
  2. Hey, guys just check please this code, and say how do you think will I be acredited to web development ? I'm a student. That was a programming assignment, which I think you will understand, because code works, just I'm concerned about style of programming, and am I not overusing some features ... sites is here and files attached as in assignment.zip http://prognet.lt/multimedia/ [attachment deleted by admin]
  3. CREATE TABLE `assignments`.`products` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `name` VARCHAR( 250 ) NOT NULL , `cost` DECIMAL( 10, 2 ) NOT NULL ) ENGINE = INNODB; CREATE TABLE `assignments`.`transactions` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `order_id` INT NOT NULL , `income` DECIMAL( 10, 2 ) NOT NULL , `cost` DECIMAL( 10, 2 ) NOT NULL , `data` DATE NOT NULL ) ENGINE = INNODB; CREATE TABLE `assignments`.`orders` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `client_id` INT NOT NULL , `product_id` INT NOT NULL , `data` DATE NOT NULL ) ENGINE = INNODB; CREATE TABLE `assignments`.`clients` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `name` INT( 250 ) NOT NULL , `lastname` INT( 250 ) NOT NULL ) ENGINE = INNODB; <?php class Myclass { protected $db; public function __construct() { $this->db = new PDO("mysql:host=localhost;dbname=zadania", "root", ""); //mysql_connect("localhost" , "root", ""); //mysql_select_db("zadania"); } public function getIncomeStatistics($month=1) { $query = "SELECT DAYOFMONTH(data) AS day, SUM(income) AS income, SUM(cost) AS cost FROM transactions GROUP BY day"; $results = $this->db->query($query); $results = $results->fetchAll(); foreach($results as $result) { $item['day'] = $result['day']; $item['profit'] = $result['income'] - $result['cost']; $return[] = $item; } return $return; } public function getOrdersStatistics($month=1){ $query = "SELECT products.name AS product, COUNT(orders.product_id) AS orders_num FROM products, orders WHERE products.id = orders.product_id GROUP BY products.id"; $results = $this->db->query($query); $results = $results->fetchAll(); foreach($results as $result) { $item['produkt'] = $result['produkt']; $item['liczba_zamowien'] = $result['liczba_zamowien']; $return[] = $item; } return $return; } public function getTopClients(){ $query = "SELECT clients.name AS client, COUNT(orders.client_id) AS orders_num , SUM(transactions.income) - SUM(transactions.cost) AS income FROM clients, orders, transactions WHERE clients.id = orders.client_id AND orders.id = transactions.order_id GROUP BY clients.id ORDER BY income DESC"; $results = $this->db->query($query); $results = $results->fetchAll(); foreach($results as $result) { $client['client'] = $result['client']; $client['orders_num'] = $result['orders_num']; $return[] = $client; } return $return; } } ?>
  4. I'm looking for someone who could test my WEB skills in overall
  5. $query = "SELECT `value` FROM your_table WHERE ......."; $query_result = mysql_query($query) or die(mysql_error().' on line '.__LINE__); if(mysql_num_rows($query_result) > 0) echo "error"........................... else echo "<input type...............
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.