Esempio n. 1
0
 /**
  * public function
  * @return multitype:Vitamins
  */
 public static function getVitamins()
 {
     $vitamin1 = new Vitamins();
     $vitamin1->setVitName('E');
     $vitamin1->setIdVit(1);
     $vitamin2 = new Vitamins();
     $vitamin2->setVitName('A');
     $vitamin2->setIdVit(2);
     $vitamin3 = new Vitamins();
     $vitamin3->setVitName('B6');
     $vitamin3->setIdVit(3);
     $vitaminsArray = array(1 => $vitamin1, 2 => $vitamin2, 3 => $vitamin3);
     return $vitaminsArray;
 }
Esempio n. 2
0
<?php

$pdo = new PDO('mysql:host=localhost;dbname=vitamins', 'root', 'root');
require_once 'vitamins.php';
$table = new Vitamins($pdo);
$vitamins = $table->getAll();
?>


<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">

    <title>Vitamin Calculator</title>

    <!-- Bootstrap core CSS -->
    <link href="./assets/css/bootstrap.min.css" rel="stylesheet">
    <!-- Custom CSS-->
    <link href="./assets/css/custom-styles.css" rel="stylesheet">
  </head>

  <body>

    <!--fixed navigation bar-->
Esempio n. 3
0
<?php

require_once 'error.php';
require_once 'Foods.php';
require_once 'Vitamins.php';
/**
 * table of Foode & Vitamins
 * @author andrus
 */
$listOfVitamins = Vitamins::getVitamins();
//vitamiinide nimekiri
$listOfVitamins[1]->insertIdOfFoods(1);
$listOfVitamins[1]->insertIdOfFoods(2);
$listOfVitamins[1]->insertIdOfFoods(3);
$listOfVitamins[2]->insertIdOfFoods(3);
$listOfVitamins[2]->insertIdOfFoods(4);
$listOfVitamins[2]->insertIdOfFoods(5);
$listOfVitamins[3]->insertIdOfFoods(2);
$listOfVitamins[3]->insertIdOfFoods(6);
$listOfVitamins[3]->insertIdOfFoods(1);
$listOfFoodsOfVitamin3 = $listOfVitamins[3]->getIdOfFooods();
$listOfFoodsOfVitamin1 = $listOfVitamins[1]->getIdOfFooods();
$listOfFoods = Foods::getFoods();
$listOfFoods[1]->insertIdOfVitamins(1);
$listOfFoods[1]->insertIdOfVitamins(3);
$listOfFoods[2]->insertIdOfVitamins(1);
$listOfFoods[2]->insertIdOfVitamins(3);
$listOfFoods[3]->insertIdOfVitamins(1);
$listOfFoods[3]->insertIdOfVitamins(2);
$listOfFoods[4]->insertIdOfVitamins(2);
$listOfFoods[5]->insertIdOfVitamins(2);