Пример #1
0
    // 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>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=<?php 
echo $apikey;
?>
Пример #2
0
 	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");
 //$row = $db->fetchSingleRow();
 $rows = $db->fetchResultset();
 echo "<br>rows=<pre>";
 print_r($rows);
 //var_dump($rows);
 echo "</pre>";
 /*$db->prepareQuery('DELETE FROM users WHERE user_name = :user_name');
 	$db->bindQueryValue(':user_name', 'aryan');
 	$db->executeQuery();
 	echo '<br>record deleted';*/
 // google map integration
 /*$createmaptable = 'CREATE TABLE IF NOT EXISTS maps (
 							id SERIAL,
 							center_lat numeric(5,3),
 							center_long numeric(6,3),
Пример #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>";