コード例 #1
0
ファイル: testmap.php プロジェクト: aryan-2016/phptestscript
<?php

// Redirect if this page was accessed directly:
if (!defined('BASE_URL')) {
    // Need the BASE_URL, defined in the config file:
    include '../includes/config.inc.php';
    // Redirect to the index page:
    $url = BASE_URL . 'index.php';
    header("Location : {$url}");
    exit;
}
$db = new DbPdoClass();
$apikey = "ArAIzaSyBdXbZEsLOkQmuHpIJrEIeEg3l07fJPwO8YaN";
$id = 2;
//$_GET['id'];
$lat = 0;
$long = 0;
$zoom = 8;
$findmap = "SELECT center_lat, center_long, zoom FROM maps WHERE id={$id}";
$db->prepareQuery($findmap);
$row = $db->fetchSingleRow();
//echo "<br>row=<pre>";print_r($row);echo "</pre>";
$lat = $row['center_lat'];
$long = $row['center_long'];
$zoom = $row['zoom'];
?>

    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">      
      #map-canvas { height: 100% }
    </style>
コード例 #2
0
ファイル: testdb.php プロジェクト: aryan-2016/phptestscript
<?php

// Redirect if this page was accessed directly:
if (!defined('BASE_URL')) {
    // Need the BASE_URL, defined in the config file:
    include '../includes/config.inc.php';
    // Redirect to the index page:
    $url = BASE_URL . 'index.php';
    header("Location : {$url}");
    exit;
}
$db = new DbPdoClass();
try {
    /*$db->prepareQuery('DROP TABLE users');
    	$db->executeQuery();
    	echo '<br>table droped';
    	
    	//$db->prepareQuery('CREATE TABLE users(id SERIAL NOT NULL, user_name character varying(20) NOT NULL, user_password character varying(20) NOT NULL, CONSTRAINT users_pkey PRIMARY KEY (id))');
    	$db->prepareQuery('CREATE TABLE users(id SERIAL NOT NULL, user_name character varying(128) NOT NULL, user_password character varying(128) NOT NULL, user_email character varying(128) NOT NULL, user_role character varying(64) NOT NULL, created_time timestamp DEFAULT current_timestamp, last_modified_time timestamp DEFAULT current_timestamp, status  smallint NOT NULL DEFAULT 1, CONSTRAINT users_pkey PRIMARY KEY (id))');
    	$db->executeQuery();
    	echo '<br>table created';*/
    /*$db->prepareQuery('INSERT INTO users (user_name, user_password) VALUES (:user_name, :user_password)');
    	$db->bindQueryValue(':user_name', 'John');
    	$db->bindQueryValue(':user_password', 'Smith');*/
    /*$db->prepareQuery("INSERT INTO users (user_name, user_password) VALUES ('John', 'Smith')");
    	$db->executeQuery();
    	echo '<br>lastInsertId=' . $db->lastInsertId();*/
    //$db->prepareQuery('SELECT user_name, user_password FROM users WHERE user_name = :user_name');
    //$db->bindQueryValue(':user_name', 'John');
    //$db->prepareQuery("SELECT user_name, user_password FROM users WHERE user_name = 'John'");
    $db->prepareQuery("SELECT * FROM users");
コード例 #3
0
<?php

$db = new DbPdoClass();
$db->prepareQuery('INSERT INTO users (user_name, user_password) VALUES (:user_name, :user_password)');
$db->bindQueryValue(':user_name', 'John');
$db->bindQueryValue(':user_password', 'Smith');
$db->executeQuery();
echo '<br>lastInsertId=' . $db->lastInsertId();
$db->prepareQuery('SELECT user_name, user_password FROM users WHERE user_name = :user_name');
$db->bindQueryValue(':user_name', 'John');
$row = $db->fetchSingleRow();
echo "<br>row=<pre>";
print_r($row);
echo "</pre>";