示例#1
0
<?php

$db;
$username = "******";
$password = "******";
$hostname = "localhost";
$database = "joel_bee_database";
try {
    //Instantiate a database object
    $db = new PDO("mysql:host={$hostname}; dbname={$database}", $username, $password);
    echo '<p>Connected to database</p>';
} catch (PDOException $e) {
    echo $e->getMessage();
}
include "Models/observationModel.php";
$obsModel = new ObservationModel($db);
$obsList = $obsModel->getAllObservations();
include "Views/observation-list.php";
$db = null;
示例#2
0
<?php

/*
 *Author: Alex Ball
 *Date: 01/15/2016
 *
 *This website is a prototype for the beehive project. This project involves
 *a website that allows beekeepers to submit data about the number of mites
 *in their beehives so that Danny Najera can review this data to support the
 *theory that mites are the biggest threat to bees.
 *
 */
//get database connection called $beeDBConnection
require '/home/alexb/secure-includes/bee-db-connection.php';
//get access to the data model
require 'models/observationmodel.php';
//create data model instance
$dataModel = new ObservationModel($beeDBConnection);
//get data rows
$resultRows = $dataModel->getAllDataRows();
//show the view
require 'views/admin-beedata-table.php';
//close connection
$beeDBConnection = null;
示例#3
0
文件: admin.php 项目: axumg/beehive
<?php

try {
    //Instantiate a database object
    $hostname = 'localhost';
    $database_name = 'axum_bee_database';
    $username = '******';
    $password = '******';
    $db = new PDO("mysql:host={$hostname};dbname={$database_name}", $username, $password);
    echo 'Connected to database';
} catch (PDOException $e) {
    echo $e->getMessage();
}
include 'models/observationmodel.php';
$obsModel = new ObservationModel($db);
//public function getAllObservations
$observation_list = $obsModel->getAllObservation();
include 'views/observation-list.php';
$db = null;
示例#4
0
<?php

require '../../db.php';
include "models/bee_observationsmodel.php";
$obsModel = new ObservationModel($dbh);
$obsList = $obsModel->getAllObservations($dbh);
include 'views/bee_observations-list.php';
$obsList = $obsModel->getAllObservations($dbh);
include 'beeData.php';
$db = null;
示例#5
0
        //close connection
        $beeDBConnection = null;
    } else {
        $getErrors = 'location: index.php?error=true';
        foreach ($errorArray as $error) {
            $getErrors .= $error;
        }
        header($getErrors);
    }
} else {
    header('location: index.php');
}
//if the submission is successful, show success view.
if (isset($success)) {
    //get database rows where the hive name matches this
    //hive name submission.
    //get database connection called $beeDBConnection
    require '/home/alexb/secure-includes/bee-db-connection.php';
    //we already have access to the bee data model from submitting
    //the form data.
    //create data model instance
    $dataModel = new ObservationModel($beeDBConnection);
    //get data rows
    $resultRows = $dataModel->getRowsByHiveName($miteFormHiveName);
    //show the view
    require 'views/user-beedata-table.php';
    //close connection
    $beeDBConnection = null;
} else {
    print '<h3>Error submitting to database.</h3>';
}