本文整理汇总了PHP中adodb_connect函数的典型用法代码示例。如果您正苦于以下问题:PHP adodb_connect函数的具体用法?PHP adodb_connect怎么用?PHP adodb_connect使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了adodb_connect函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: limit_view_all_bids
function limit_view_all_bids(&$selectionSQL, &$sort, &$showing, $max_view_per_page = MAX_PAPER, $err_message = "")
{
//Establish connection with database
$db = adodb_connect(&$err_message);
//Check the sorting by Title
switch ($sort) {
case 3:
$selectionSQL .= " ORDER BY Title ASC";
break;
case 4:
$selectionSQL .= " ORDER BY Title DESC";
break;
case 5:
$selectionSQL .= " ORDER BY PaperID ASC";
break;
case 6:
$selectionSQL .= " ORDER BY PaperID DESC";
break;
default:
$selectionSQL .= " ORDER BY PaperID";
break;
}
//Limit the records to the maximun papers per page
$selectionSQL .= " LIMIT " . $showing . "," . MAX_PAPER;
$selectionResult = $db->Execute($selectionSQL);
if (!$selectionResult) {
$err_message .= " Unable to query database. <br>\n";
return NULL;
}
return $selectionResult;
}
示例2: get_chair_usernames
function get_chair_usernames()
{
//Establish connection with database
$db = adodb_connect();
if (!$db) {
echo "Could not connect to database server - please try later.";
exit;
}
$sql = "SELECT * FROM " . $GLOBALS["DB_PREFIX"] . "Member AS M, ";
$sql .= $GLOBALS["DB_PREFIX"] . "Registration as R ";
$sql .= "WHERE M.RegisterID = R.RegisterID ";
//$sql .= "WHERE PrivilegeTypeID > 1 ";
$sql .= "ORDER BY M.PrivilegeTypeID DESC, R.LastName ASC";
$result = $db->Execute($sql);
$users = array();
while ($user = $result->FetchNextObj()) {
$users[] = $user;
}
return $users;
}
示例3: session_start
$php_root_path = "..";
$privilege_root_path = "/admin";
require_once "includes/include_all_fns.inc";
session_start();
global $valid_user;
extract($_GET, EXTR_REFS);
$err_message = " Unable to process your request due to the following problems: <br>\n";
if (!check_valid_user(&$err_message)) {
//This user is not login
do_html_header("View File Failed", &$err_message);
$err_message .= " Sorry, You must login to view this file. <br>\n";
$err_message .= "<br><br> Go to <a href='{$php_root_path}/index.php'>Login</a> page.";
do_html_footer(&$err_message);
exit;
}
$db = adodb_connect(&$err_message);
if (!$db) {
do_html_header("View File Failed", &$err_message);
$err_message .= " Could not connect to database server - please try later.<br>\n";
$err_message .= "<br><br> Try <a href='view_file.php?fileid=" . $_GET["fileid"] . "'>again</a>?";
do_html_footer(&$err_message);
exit;
}
$sql = "SELECT File,FileName,FileSize,FileType FROM " . $GLOBALS["DB_PREFIX"] . "File F , " . $GLOBALS["DB_PREFIX"] . "Paper P";
$sql .= " WHERE F.FileID=" . $_GET["fileid"] . " AND F.PaperID=P.PaperID";
$result = $db->Execute($sql);
$rows = $result->RecordCount();
if (!$result) {
do_html_header("View File Failed", &$err_message);
$err_message .= " Could not connect to File database.<br>\n";
$err_message .= "<br><br> Try <a href='view_file.php?fileid=" . $_GET["fileid"] . "'>again</a>?";
示例4: session_start
<?php
$php_root_path = "..";
$privilege_root_path = "/admin";
require_once "includes/include_all_fns.inc";
session_start();
if (!($db = adodb_connect())) {
do_html_header("Create Attendee Registration Form — Error");
do_html_footer("Error connecting to database.");
exit;
}
require_once "includes/rego_form_functions.php";
// page used for creating form as well as displaying help
if ($_GET['help'] == "viscond") {
// display help
do_html_header("Help: Visibility Conditions");
?>
<p>An advanced feature of the registration form is the ability to set <em>Visibility
Conditions</em>. They allow you to specify that a particular group or field
will only be displayed or enabled after another condition has been satisfied.</p>
<p>Each group or field has two visibility properties – <em>visible</em> and <em>enabled</em>
– each with two options – <em>true</em> or <em>false</em>. There
is only one event – <em>when</em> – which is triggered when the
specified field changes (either the text changes or a different option is
selected).</p>
<p>Groups and fields are specified using the numbers that appear beside the
fields in blue. For example, [3:5] represents group 3, field 5. If the
field is a checkbox group, radio group, drop-down menu or selectable
list, you can reference the field's options numerically by counting the
number of options starting at 1. However, if the first option of a drop-down
menu is <em>--- (select) ---</em>, this does not count as an option and the
示例5: session_start
<?php
$php_root_path = "..";
$privilege_root_path = "/admin";
require_once "includes/include_all_fns.inc";
session_start();
// extract ( $_SESSION , EXTR_REFS ) ;
$err_message = " Unable to process your request due to the following problems: <br>\n";
do_html_header("View All Users");
//Establish connection with database
$db = adodb_connect();
if (!$db) {
echo "Could not connect to database server - please try later.";
exit;
}
$memberSQL = "SELECT * FROM " . $GLOBALS["DB_PREFIX"] . "Member M," . $GLOBALS["DB_PREFIX"] . "PrivilegeType P," . $GLOBALS["DB_PREFIX"] . "Registration R";
$memberSQL .= " WHERE M.RegisterID <> 0";
$memberSQL .= "\tAND M.PrivilegeTypeID = P.PrivilegeTypeID";
$memberSQL .= "\tAND M.RegisterID = R.RegisterID";
$memberSQL .= "\tAND P.PrivilegeTypeName = 'Reviewer'";
//Check the sorting by Title
switch ($HTTP_GET_VARS["sort"]) {
case 1:
$memberSQL .= " ORDER BY M.MemberName ASC";
$sortStr = "UserName - Ascending";
break;
case 2:
$memberSQL .= " ORDER BY M.MemberName DESC";
$sortStr = "UserName - Descending";
break;
case 3:
示例6: validatePDF_callback
function validatePDF_callback($file_data, $valid, $magic, $fileID)
{
$file_size = strlen($file_data);
global $DEBUG;
if ($DEBUG) {
informAdmin("DEBUG validatePDF_callback.php: called validatePDF_callback( <binary>, {$valid}, {$magic}, {$fileID} )");
}
// sanitize all parameters
$fileID = intval($fileID);
$magic = intval($magic);
if ($valid) {
$valid = 1;
} else {
$valid = 0;
}
// put result into database
$err_message = "validatePDF_callback(): ";
$db = adodb_connect();
// FIXME: fix declaration of adodb_connect() to include the reference (&) symbol!
if ($db) {
$file_data = $db->qstr($file_data);
// escape binary
$sql = "UPDATE " . $GLOBALS["DB_PREFIX"] . "File_report SET File={$file_data}, FileSize={$file_size}, DateTime=NOW(), Valid={$valid} WHERE FileID = {$fileID} AND Magic = {$magic}";
if (!$db->Execute($sql)) {
informAdmin("{$err_message} executing SQL query:\n" . $db->MetaErrorMsg($db->MetaError()));
}
} else {
informAdmin("{$err_message} \$db is invalid\n" . $db->MetaErrorMsg($db->MetaError()));
}
}
示例7: adodb_connect
/**
* Get a handle to the ADODB database object. You can then use this
* to perform all kinds of database operations.
*
* @link http://phplens.com/lens/adodb/docs-adodb.htm
* @final
* @return ADOConnection a handle to the ADODB database object
*/
function &GetDb()
{
global $DONT_LOAD_DB;
/* Check to see if we have a valid instance.
* If not, build the connection */
if (!isset($this->db) && !isset($DONT_LOAD_DB)) {
$this->db =& adodb_connect();
}
$db =& $this->db;
return $db;
}
示例8: adodb_connect
/**
* Get a handle to the ADODB database object. You can then use this
* to perform all kinds of database operations.
*
* @link http://phplens.com/lens/adodb/docs-adodb.htm
* @final
* @return ADOConnection a handle to the ADODB database object
*/
public function &GetDb()
{
global $DONT_LOAD_DB;
/* Check to see if we have a valid instance.
* If not, build the connection */
if (!isset($this->db) && (!isset($DONT_LOAD_DB) || $DONT_LOAD_DB == 'force')) {
$this->db = adodb_connect();
}
return $this->db;
}
示例9: redisplay
function redisplay(&$paperid_array, &$process, &$dbprefix, $err_message = "")
{
//Establish connection with database
$db = adodb_connect(&$err_message);
//global $_SESSION ;
$i = 0;
$array = array();
reset($paperid_array);
foreach ($paperid_array as $some => $paperID) {
//Get the paper information
if (($paperInfo = get_paper_info($paperID, &$err_message)) === false) {
do_html_header("Update Paper Bids Failed", &$err_message);
$err_message .= " Cannot retrieve information from database. <br>\n";
$err_message .= "<br><br> Try <a href='" . $_SERVER["PHP_SELF"] . "?" . $_SERVER["QUERY_STRING"] . "'>again</a>?";
do_html_footer(&$err_message);
exit;
}
$array[$i]["paperid"] = $paperInfo->PaperID;
$array[$i]["papertitle"] = stripslashes($paperInfo->Title);
//Get the lastest file of the paper
if (($FileIDData = get_latestFile($paperID, &$err_message)) === false) {
do_html_header("Update Paper Bids Failed", &$err_message);
$err_message .= " Could not execute \"get_latestFile\" in \"update_biddings.php\". <br>\n";
$err_message .= "<br><br> Try <a href='" . $_SERVER["PHP_SELF"] . "?" . $_SERVER["QUERY_STRING"] . "'>again</a>?";
do_html_footer(&$err_message);
exit;
}
$array[$i]["fileid"] = $FileIDData->FileID;
if ($catcomsep = getSelectedCategoryCommaSeparated($paperInfo->PaperID, &$err_message) || numCategories(&$err_message) == 0) {
$array[$i]["cat"] = $catcomsep;
} else {
do_html_header("Update Paper Bids Failed", &$err_message);
$err_message .= " Could not execute \"getSelectedCategoryCommaSeparated\" in \"update_biddings.php\". <br>\n";
$err_message .= "<br><br> Try <a href='" . $_SERVER["PHP_SELF"] . "?" . $_SERVER["QUERY_STRING"] . "'>again</a>?";
do_html_footer(&$err_message);
exit;
}
if ($authors = retrieve_authors($paperInfo->PaperID, &$err_message)) {
$array[$i]["author"] = $authors;
} else {
do_html_header("Update Paper Bids Failed", &$err_message);
$err_message .= " Could not execute \"retrieve_authors\" in \"update_biddings.php\". <br>\n";
$err_message .= "<br><br> Try <a href='" . $_SERVER["PHP_SELF"] . "?" . $_SERVER["QUERY_STRING"] . "'>again</a>?";
do_html_footer(&$err_message);
exit;
}
if ($process === "update") {
$preferenceSQL = " SELECT PreferenceID FROM " . $GLOBALS["DB_PREFIX"] . "Selection ";
$preferenceSQL .= " WHERE PaperID = " . $paperInfo->PaperID;
$preferenceSQL .= " AND Membername = '" . $_SESSION["valid_user"] . "'";
$preferenceResult = $db->Execute($preferenceSQL);
if (!$preferenceResult) {
do_html_header("Update Paper Bids Failed", &$err_message);
$err_message .= " Could not query \"Selection\" table in database by \"redisplay()\" of \"update_biddings.php\". <br>\n";
$err_message .= "<br><br> Try <a href='" . $_SERVER["PHP_SELF"] . "?" . $_SERVER["QUERY_STRING"] . "'>again</a>?";
do_html_footer(&$err_message);
exit;
}
$userPreference = $preferenceResult->FetchNextObj();
$array[$i]["bidid"] = $userPreference->PreferenceID;
}
if ($bidtable = Generate_Preference_Radio_Input_Table($paperInfo->PaperID, $array[$i]["bidid"], &$err_message)) {
$array[$i]["bid"] = $bidtable;
} else {
do_html_header("Update Paper Bids Failed", &$err_message);
$err_message .= " Could not execute \"retrieve_authors\" in \"update_biddings.php\". <br>\n";
$err_message .= "<br><br> Try <a href='" . $_SERVER["PHP_SELF"] . "?" . $_SERVER["QUERY_STRING"] . "'>again</a>?";
do_html_footer(&$err_message);
exit;
}
$i++;
}
//End of for loop
return $array;
}
示例10: GetSelectedLevelList
function GetSelectedLevelList(&$paperID, $err_message = "")
{
//Establish connection with database
$db = adodb_connect(&$err_message);
$sql = "SELECT LevelID FROM " . $GLOBALS["DB_PREFIX"] . "PaperLevel ";
$sql .= " WHERE PaperID = {$paperID} ";
$result = $db->Execute($sql);
$levelList = array();
if (!$result) {
$err_message .= " Could not get records from the PaperLevel Table <br>\n ";
// Exception has occurred
return false;
} else {
while ($record = $result->FetchNextObj()) {
$levelList[] = $record->LevelID;
}
}
return $levelList;
}