Beispiel #1
0
/*
This database class contains
	
CountRow	($params=array(), &$debug=false)
FetchRow	($params=array(), &$debug=false)
InsertRow	($params=array(), &$debug=false)
UpdateRow	($params=array(), &$debug=false)
DeleteRow	($params=array(), &$debug=false)
JoinFetchRow			($params=array(), &$debug=false)
InsertOrUpdateRow		($params=array(), $UniqueField=null, &$debug=false)
InsertUpdateOrDeleteRow	($params=array(), $UniqueField=null, &$debug=false)
----------------------------------------------------------------------------
SERVER::dump($var); will display the contents of the variable: array/object or otherwise
*/
require_once 'lib/db1.class.php';
$DB = new DB1($DBc);
$DB->OpenConnection();
//accociative select all ------------------------------------------------
$fetchParams = array('table' => 'users2', 'select_items' => '*', 'row_key' => 'id');
SERVER::dump($fetchParams);
//display params
$result = $DB->FetchRow($fetchParams);
$result = json_encode($result, JSON_PRETTY_PRINT);
SERVER::dump($result);
//display results
SERVER::dump($result);
//display results
//==============================================================
//example fo some capabilities
$fetchParams = array('table' => 'users2', 'select_items' => array('username', 'id'), 'order' => 'desc', 'by' => 'id', 'row_key' => 'id', 'limit' => 5, 'where_items' => array('deleted' => 0, 'blocked' => 1));
$result = $DB->FetchRow($fetchParams);
Beispiel #2
0
$(function() {
    $("#make").chained("#year");
    $("#model").chained("#make");
});

</script>

<?php 
error_reporting(E_ERROR | E_PARSE);
//Easy Code No warings/notices errors
require_once 'lib/server.class.php';
//Paste to unlock
require_once 'lib/db1.class.php';
$DBc = array('host' => 'localhost', 'username' => 'root', 'password' => 'root', 'database' => 'jacphp');
$DB = new DB1($DBc);
$DB->OpenConnection();
//==============================================================
//=======================================================================
$limit = 1000;
$page = isset($_GET['p']) ? $_GET['p'] : 1;
// default page 1
$offset = $limit * ($page - 1);
$fetchParams = array('table' => 'records', 'select_items' => '*', 'limit' => $limit, 'offset' => $offset);
$man = $DB->FetchRow($fetchParams);
//$result = $DB->CountRow($fetchParams);
//SERVER::dump($man);
$arr = array();
print '<script>
    var filepath = "Wrong.txt"; // Use this instead
    var fileObject = fso.OpenTextFile(filepath, 8, true);
Beispiel #3
0
        $question = 'Best Highway Fuel Consumption';
        $get = $_GET['by'];
        continue;
    case 'annualfuel':
        $question = 'Best Annual Fuel Consumption';
        $get = $_GET['by'];
        continue;
    case 'emission':
        $question = 'Least CO2 Emissions';
        $get = $_GET['by'];
        continue;
    default:
        header('Location: ' . WEB_JACPHP . 'index.php');
        exit;
}
$DB = new DB1($DBc);
$DB->OpenConnection();
//==================================================================
//Fetch car dara ----------------------------
$fetchParams = array('table' => 'records', 'select_items' => array($get, 'year', 'maker', 'model', 'cartype', 'img'), 'order_by' => $get . ' ASC', 'limit' => '0,10');
$fetch = $DB->FetchRow($fetchParams);
//Build array of Cars --------------------------
$A = array();
foreach ($fetch as $row) {
    $choice = $row[$get];
    $year = $row['year'];
    $model = $row['model'];
    $maker = $row['maker'];
    $cartype = $row['cartype'];
    if (empty($row['img'])) {
        $img = WEB_CONTENT . 'images/missing_car.png';
Beispiel #4
0
function SHOW_PRETTY($result)
{
    $pretty = SERVER::json_pretty($result);
    //convert structure or json
    SERVER::dump($pretty, 'JSON');
    //dump string to the screen
}
/////////////////////////////////////////////////////
//##############################################
//############  IMPORT DB CLASS  ###############
//##############################################
//==============================================-----+
require_once 'include/jordan/lib/db1.class.php';
//require_once('lib/dbcon.php');
$DBc = array('host' => 'localhost', 'username' => 'root', 'password' => 'root', 'database' => 'jacphp');
$DB = new DB1($DBc);
$DB->OpenConnection();
//===================================================
/////////////////////////////////////////////////////
/*
//Get sample data
$fetchParams = array(
	'table'			=>	'users2',
    'select_items'	=>	'*',
    'row_key'		=>	'id',	//field from select to amke as key
);
$result = $DB->FetchRow($fetchParams);	
SERVER::dump($result);
//*/
/////////////////////////////////////////////////////
//===================================================
Beispiel #5
0
$(function() {
    $("#make").chained("#year");
    $("#model").chained("#make");

});

</script>

<?php 
error_reporting(E_ERROR | E_PARSE);
//Easy Code No warings/notices errors
require_once 'lib/server.class.php';
//Paste to unlock
require_once 'lib/db1.class.php';
$DBc = array('host' => 'localhost', 'username' => 'root', 'password' => 'root', 'database' => 'jacphp');
$DB = new DB1($DBc);
$DB->OpenConnection();
//==============================================================
//example fo some capabilities
$fetchParams = array('table' => 'records', 'select_items' => 'maker', 'row_key' => 'maker', 'flat_result' => true);
$man = $DB->FetchRow($fetchParams);
//$result = $DB->CountRow($fetchParams);
//SERVER::dump($result);
$i = 1;
$fetchThis = array('table' => 'records', 'select_items' => array('year', 'maker', 'model', 'cartype'), 'limit' => 100);
$all = $DB->FetchRow($fetchThis);
$working = array();
$url = array();
$num = 0;
foreach ($all as $i) {
    $theMaker = trim($all[$num][maker]);