packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/db.php
author Dan Fuhry <dan@enanocms.org>
Sat, 23 Feb 2013 14:26:38 -0500
changeset 9 f4bf6556fb9f
parent 8 f68fdcc18df9
permissions -rw-r--r--
Merged
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     1
<?php
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     2
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     3
global $db;
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     4
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     5
function db_setup()
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     6
{
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     7
	global $db, $mysql;
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     8
	
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     9
	$db = new PDO("mysql:host={$mysql['host']};user={$mysql['user']};{$mysql['password']};dbname={$mysql['dbname']}");
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    10
}
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    11
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    12
function db_prepare($sql)
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    13
{
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    14
	global $db;
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    15
	
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    16
	$st = $db->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    17
	return $st;
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    18
}
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    19
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    20
db_setup();