当前位置: 首页>>代码示例>>PHP>>正文


PHP openDatabase函数代码示例

本文整理汇总了PHP中openDatabase函数的典型用法代码示例。如果您正苦于以下问题:PHP openDatabase函数的具体用法?PHP openDatabase怎么用?PHP openDatabase使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了openDatabase函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addUser

function addUser()
{
    $con = openDatabase();
    mysql_query("insert into user(`name`) values ('cuzn')");
    mysql_query("insert into user(`name`) values ('cjx')");
    mysql_close($con);
}
开发者ID:cuzn1024,项目名称:minitools,代码行数:7,代码来源:database.php

示例2: connectClass

 function connectClass()
 {
     global $strings, $MY_DBH, $databaseType;
     if ($databaseType == 'mysql') {
         $MY_DBH = openDatabase();
     }
 }
开发者ID:jgatica,项目名称:Netoffice,代码行数:7,代码来源:request.class.php

示例3: queryMySQLData

function queryMySQLData($query)
{
    $database = openDatabase(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_CHARSET);
    if (strpos($query, 'UPDATE') || strpos($query, 'INSERT')) {
        $database->query($query);
        closeDatabase($database);
        return true;
    }
    $ergebnis = $database->query($query);
    closeDatabase($database);
    if (is_object($ergebnis)) {
        return $ergebnis;
    } elseif ($ergebnis == true) {
        return true;
    }
    return false;
}
开发者ID:extendgears,项目名称:php-components,代码行数:17,代码来源:mysql.php

示例4: openDatabase

     $errorStatus = 1;
 }
 if (!$db_username) {
     $errorMsg .= "- MySQL user name<BR>";
     $errorStatus = 1;
 }
 if (!$db_password) {
     $errorMsg .= "- MySQL password<BR>";
     $errorStatus = 1;
 }
 if ($errorStatus == 1) {
     echo $errorMsg . "<P>Please check your config.php for missing or incomplete data and try again.";
     exit;
 }
 // OPEN CONNECTION TO THE DATABASE
 $db_link = openDatabase($db_hostname, $db_username, $db_password, $db_name);
 //*******************
 // doQuery();
 //*******************
 function doQuery($sql)
 {
     global $db_link;
     mysql_query($sql) or die(reportSQLError($sql));
 }
 //  BEGIN 1.03 to 1.04 UPGRADE
 echo "Upgrading from 1.03 to 1.04, the debut of multi-language version !!! <br>\n\t\tThe multi language capability is not present for install.php nor upgrade.php<br>\n\t\tThis upgrade makes the following changes to the database:<p>\n\t\t1. Removes the counter and implements auto increment<br>\n\t\t2. Removes the country table and replaces it with an array imported from a language file.<br>\n\t\t3. Updates the address information from old numeric country code to new alpha country code. <br>\n\t\t4. Makes several changes and additions to the options table<br>\n\t\t5. Makes changes to the user table<br>\n\t\t6. Improves address information handling and flexibility.<br>\n\t\t<br>";
 // function numb2alph() TAKES A NUMERIC COUNTRY CODE, FINDS THE COUNTRY NAME, THEN FINDS THAT NAME IN ALPHA TABLE AND RETURNS THE ALPHA CODE.
 function numb2alph($countryNumber)
 {
     global $db_link;
     global $db_prefix;
开发者ID:hsrai,项目名称:GNDEC-SMS-Service,代码行数:31,代码来源:upgrade.php

示例5: _

<?php

include 'includes/session.inc';
$title = _('Michigan Section NTS');
include 'includes/miscFunctions.inc';
$db = openDatabase($dppE);
mysql_select_db($DatabaseName, $db);
NTSheader($title, "NTS Michigan Section Traffic");
// Remember the launch time
$starttime = strftime("%A, %B %d %Y, %H:%M");
leftBar($db);
?>
  <div id="main">

<?php 
// Initialize the latest data counter
$maxdate = 0;
// Get the requested period, if blank choose the latest
$period = $_GET['period'];
if ($period < 1) {
    $SQL = "SELECT MAX(`period`) FROM `netreport`";
    $period = singleResult($SQL, $db);
}
echo "    <center>\n";
$lastperiod = $period;
echo "<p><h1>Net History</h1></p>\n";
echo "<table width=\"90%\">\n";
echo "<tr><th align=\"left\">Period</th><th>QNI</th><th>QTC" . "</th><th>QTR</th><th>Sess</th><th>Hours</th></tr>\n";
for ($period = $lastperiod; $period > 71; $period--) {
    // Display the month name for this report
    $SQL = 'SELECT `lastday` FROM `periods` WHERE `periodno`=' . $period;
开发者ID:jjmcd,项目名称:mi-nts,代码行数:31,代码来源:nettotals.php

示例6: ob_start

<?php

require "../php/header.php";
ob_start();
$name = $HTTP_GET_VARS['name'];
if ($name == null) {
    header("Location: index.php");
    exit;
}
openDatabase(false);
$players = getPlayers($name, 50);
if (count($players) == 1) {
    if (getPid($name) != 0) {
        header("Location: playerinfo.php?name=" . urlencode($name));
        closeDatabase();
        exit;
    }
}
ob_end_flush();
$html_title = "WinBolo.net: Search Results for {$name}";
include "{$BASE_FILES}/inc_top.php";
$error_heading = "Search Results";
if (count($players) == 0) {
    $error_body = "Sorry, no matches to your query.";
} else {
    $error_body = "Search Results (Limit 50 matches)<P>";
    $count = 0;
    while ($count < count($players)) {
        $error_body .= "<a href=\"playerinfo.php?name=" . urlencode($players[$count]) . "\">" . $players[$count] . "</A><BR>";
        $count++;
    }
开发者ID:andrewroth,项目名称:winbolo,代码行数:31,代码来源:searchplayer.php

示例7: openHTML

<?php

include 'functions.inc';
openHTML("Edit Memo", "memos Palm");
$db = openDatabase('myToDo');
$id = $_GET['item'];
echo "<p>Item: " . $id . "</p>\n";
$q1 = "SELECT A.`title`,A.`content`,A.`category`,B.`color` " . "FROM `memos` A, `categories` B " . "WHERE A.`memo_id`=" . $id . " AND  A.`category` = B.`cat_id`";
//echo "<p>[" . $q1 . "]</p>\n";
$r1 = getResult($q1, $db);
$row = mysql_fetch_row($r1);
echo "<form name=\"memo\" method=\"post\" action=\"memo2.php?item=" . $id . "\">\n";
echo "<b><input type=\"text\" name=\"title\" size=\"34\" value=\"" . $row[0] . "\" style=\"background-color: " . $row[3] . "; \" /></b>\n";
echo "<textarea name=\"content\" cols=\"36\" rows=\"40\">\n";
echo $row[1] . "\n";
echo "</textarea><br />\n";
echo "<p>&nbsp;</p>\n<center>\n";
echo "<input type=\"submit\" value=\"Submit\" style=\"font-size: 28pt; \">\n";
echo "<p>&nbsp;</p>\n";
echo "<a href=\"memo.php\">Back to list</a>\n";
echo "<p>&nbsp;</p>\n";
echo "</form>\n";
closeHTML();
开发者ID:jjmcd,项目名称:PalmPre,代码行数:23,代码来源:memo1.php

示例8: date

    $task .= "<td>{$task_priority}</td>";
    // the task status
    $task .= "<td>{$task_status}</td>";
    // the due date
    $task .= "<td align=\"center\">{$row['6']}</td></tr>\n";
    return $task;
}
// set up general variables and functions
$datenow = date("Y-m-d");
/* Date of today */
$content_type = $send_html ? "text/html" : "text/plain";
$notice_list = array();
$notice_name = array();
// get the list of resources with tasks to list
$sql = "SELECT distinct mem.id, mem.email_work, mem.name \r\nFROM " . $tableCollab["members"] . " mem, " . $tableCollab["tasks"] . " tas\r\nWHERE mem.organization = " . $orgID . "\r\nAND tas.status  IN (2,3) \r\nAND mem.id = tas.assigned_to";
$res = openDatabase();
$rows = mysql_query($sql, $res);
while ($row = mysql_fetch_row($rows)) {
    $notice_list[$row[0]] = $row[1];
    $notice_name[$row[0]] = $row[2];
}
@mysql_free_result($rows);
// iterate through the list of resources and pull all their tasks
foreach ($notice_list as $staffid => $email) {
    $recipient_name = $notice_name[$staffid];
    if ($test == 1) {
        $email = $test_email;
    }
    print "mailing to {$recipient_name} <{$email}>\n";
    $content = task_header($recipient_name);
    $sql = "SELECT tas.id, tas.name, pro.id, pro.name, tas.priority, tas.status, tas.due_date\r\n    FROM " . $tableCollab["tasks"] . " tas, " . $tableCollab["projects"] . " pro\r\n    WHERE tas.status IN (2,3) \r\n    AND tas.project = pro.id\r\n    AND tas.assigned_to = '{$staffid}'\r\n    ORDER BY tas.due_date, tas.status";
开发者ID:jgatica,项目名称:Netoffice,代码行数:31,代码来源:taskreminder.php

示例9: processServerKeyRequest

function processServerKeyRequest($data)
{
    $ip = getenv("REMOTE_ADDR");
    $gameType = ord($data[0]);
    $ai = ord($data[1]);
    $mines = ord($data[2]);
    $password = ord($data[3]);
    $freeBases = ord($data[4]);
    $freePills = ord($data[5]);
    $numPlayers = ord($data[6]);
    $numBases = ord($data[7]);
    $numPills = ord($data[8]);
    $mapLen = ord($data[9]);
    $mapName = substr($data, 10, $mapLen);
    $pos = 10 + $mapLen;
    $port = unpack("nid", substr($data, $pos, 2));
    $port = $port[id];
    $pos += 2;
    $startTime = time();
    //$startTime = unpack("Nid", $startTime);
    //$startTime = $startTime[id];
    openDatabase(true);
    $now = time();
    srand($now);
    $key = getNewServerKey(md5($now . rand() . $ip . rand() . $port . $mapName . rand() . $password . $mines . $startTime . time() . rand()));
    $mapName = mysql_escape_string($mapName);
    $ipAddress = $ip;
    $ip = gethostbyaddr($ip);
    if (gethostbyname($ip) != $ipAddress) {
        $ip = $ipAddress;
    }
    # Fix for west
    if ($ip == "gatekeeper.nt4.com") {
        $ip = "west.winbolo.com";
    }
    #Fix for sheeps
    if ($ip == "ool-4351bf05.dyn.optonline.net") {
        $ip = "sheeps.winbolo.us";
    }
    #Fix for fermat
    if ($ip == "c-69-136-99-180.hsd1.pa.comcast.net") {
        $ip = "fermat.winbolo.us";
    }
    #Fix for canuck
    if ($ip == "CPE0002446032e4-CM000039fbb861.cpe.net.cable.rogers.com") {
        $ip = "winbolo.dhs.org";
    }
    #Fix for paniq
    if ($ipAddress == "207.88.53.107") {
        $ip = "paniq.winbolo.us";
    }
    #Fix for bluebot
    if ($ip == "pool-141-154-115-77.bos.east.verizon.net") {
        $ip = "bluebot.winbolo.us";
    }
    #Fix for renbot
    if ($ip == "dsl092-218-111.sfo2.dsl.speakeasy.net") {
        $ip = "renbot.winbolo.us";
    }
    if ($ip == "12.39.4.70") {
        $ip = "pawnyBot.winbolo.us";
    }
    #CCBot
    if ($ipAddress == "24.4.42.190") {
        $ip = "ccbot.winbolo.us";
    }
    #NYCBot
    if ($ip == "cpe-68-173-217-129.nyc.res.rr.com") {
        $ip = "nycbot.winbolo.us";
    }
    # Acrobot
    if ($ip == "cpe-24-195-41-47.nycap.res.rr.com") {
        $ip = "acrobot.winbolo.us";
    }
    # Alexmbot
    if ($ip == "chanxmail.swmc.org") {
        $ip = "alexmbot.winbolo.us";
    }
    #me
    if ($ip == "johnmorrison.name") {
        $ip = "winbolo.net";
    }
    $ip = mysql_escape_string($ip);
    $sql = "insert into game_server (gs_key, gs_ip, gs_port, gs_mapname, gs_password, gs_mines, gs_numbases, gs_numpills, gs_freebases, gs_freepills, gs_numtanks, gs_starttime, gs_firstheard, gs_lastheard, gs_ai, gs_gametype) values ('{$key}', '{$ip}', '{$port}', '{$mapName}', '{$password}', '{$mines}', '{$numBases}', '{$numPills}', '{$freeBases}', '{$freePills}', '{$numPlayers}', '{$startTime}', '{$now}', '{$now}', '{$ai}', '{$gameType}')";
    $result = mysql_query($sql);
    if (mysql_affected_rows() != 1) {
        writeError("Database error. ");
    }
    closeDatabase();
    return $key;
}
开发者ID:andrewroth,项目名称:winbolo,代码行数:91,代码来源:wbn.php

示例10: getCategories

    }
    return null;
}
function getCategories($Database)
{
    $result = $Database->query('SELECT DISTINCT action FROM message');
    if (!$result) {
        echo 'Could not get categories: ';
        print_r($Database->errorInfo());
        die;
    }
    return $result;
}
//And now ladies and gentlemen, procedural hell...
//open the database
$db = openDatabase($databaseFilename);
//delete a message if one has been toggled for removal
removeMessage($db, $remove);
//this array is filled with the id's of every message display in this instance of this page.
//at the end, the showCount columns for these messages are updated to reflect they have been shown.
//(this is handy for marking new items are being viewed, and for seeing which messages are looked
// at the most, "favourites" if you will.)
$shownIds = array();
//display the filter option column titles
echo '<form action="monkeyview.php" method="get">';
echo $filterTableHeader;
//"added" filter box
echo '<tr>';
echo '<td><select name="added">';
foreach ($addedOptions as $option) {
    $selected = $option == $added ? ' selected' : '';
开发者ID:noshbar,项目名称:HelperMonkeyBot,代码行数:31,代码来源:monkeyview.php

示例11: _sess_mysql_gc

function _sess_mysql_gc($max_lifetime)
{
    global $MY_DBH, $tableCollab;
    $valid_session_time = time() - 172800;
    // 48 hrs ago
    // Delete old values from the sessions table, greater than 48 hrs old
    $query = 'DELETE FROM ' . $tableCollab['sessions'] . ' WHERE last_access < ' . $valid_session_time;
    // check database connection, reconnect if necessary
    $MY_DBH = openDatabase();
    // Execute the query
    if (!($result = mysql_query($query, $MY_DBH))) {
        // error with query
        print '<li>Unable to query the database ' . MYDATABASE;
        print '<li>MySQL Error: ' . mysql_error();
        exit;
    }
    // Free up resources used by the query
    @mysql_free_result($result);
    return $result;
}
开发者ID:jgatica,项目名称:Netoffice,代码行数:20,代码来源:library.php

示例12: openDatabase

$block1->contentRow('File Management', $fileManagement . " (default max file size {$maxFileSize} {$byteUnits['0']})");
if ($mkdirMethod == 'FTP') {
    $mkdirMethodMore = ' (Path to root with mentionned account: ' . $ftpRoot . ')';
}
$block1->contentRow('Create folder method', $mkdirMethod . $mkdirMethodMore);
$block1->contentRow('Theme', THEME);
$block1->contentRow('Product Site Publish', $sitePublish);
$block1->contentRow('Notifications', $notifications);
$block1->contentRow('Root', $root);
if ($useLDAP == true) {
    $loginMethodMore = ' + LDAP';
}
$block1->contentRow('Login Method', $loginMethod . $loginMethodMore);
if ($databaseType == 'mysql') {
    $databaseTypeMore = 'MySql';
    $MY_DBH = openDatabase();
    $local_query = 'SELECT VERSION() as version';
    $res = mysql_query($local_query, $MY_DBH);
    $databaseVersion = mysql_result($res, 0, 'version');
}
$block1->contentRow('Database Type', $databaseTypeMore);
$block1->contentRow('Files folder size', convertSize(folder_info_size('../files/')));
$block1->contentTitle($strings['system_properties']);
$block1->contentRow('PHP Version', phpversion() . ' ' . buildLink('../administration/phpinfo.php?', 'PhpInfo', LINK_BLANK));
$block1->contentRow($databaseTypeMore . ' version', $databaseVersion);
$block1->contentRow('extension_dir', ini_get(extension_dir));
$ext = get_loaded_extensions();
$comptExt = count($ext);
for ($i = 0; $i < $comptExt; $i++) {
    $extensions .= $ext[$i];
    if ($i != $comptExt - 1) {
开发者ID:jgatica,项目名称:Netoffice,代码行数:31,代码来源:systeminfo.php

示例13: importUMLSFromDatabase

function importUMLSFromDatabase( $server, $databaseName, $userName, $password, $sources = null ) {
	$result = new UMLSImportResult;

	openDatabase( $server, $databaseName, $userName, $password );
	
	$languageId = 85;
	echo "Creating UMLS collections\n";
	$umlsCollectionId = bootstrapCollection( "UMLS", $languageId, "" );
	$result->umlsCollectionId = $umlsCollectionId;
	
	$relationCollectionId = bootstrapCollection( "UMLS Relation Types 2005", $languageId, "RELT" );
	addDefinedMeaningToCollection( getCollectionMeaningId( $relationCollectionId ), $umlsCollectionId, "rel" );
	$relationAttributesCollectionId = bootstrapCollection( "UMLS Relation Attributes 2005", $languageId, "RELT" );
	addDefinedMeaningToCollection( $relationAttributesCollectionId, $umlsCollectionId, "rela" );
	$semanticNetworkSemanticTypesCollectionId = bootstrapCollection( "Semantic Network 2005AC Semantic Types", $languageId, "CLAS" );
	addDefinedMeaningToCollection( getCollectionMeaningId( $semanticNetworkSemanticTypesCollectionId ), $umlsCollectionId, "STY" );
	$semanticNetworkRelationTypesCollectionId = bootstrapCollection( "Semantic Network 2005AC Relation Types", $languageId, "RELT" );
	addDefinedMeaningToCollection( getCollectionMeaningId( $semanticNetworkRelationTypesCollectionId ), $umlsCollectionId, "RL" );
	
	echo "Loading source abbreviations\n";
	$sourceAbbreviations = loadSourceAbbreviations( $sources );
	
	echo "Loading languages\n";
	$isoLanguages = loadIsoLanguages();
	
	echo "Importing UMLS terms per source\n";
	$i = 1;
	foreach ( $sourceAbbreviations as $sab => $source ) {
		$collectionId = bootstrapCollection( $source, $languageId, "" );
		$result->sourceAbbreviations[$sab] = $collectionId;
		echo "  $i: $sab - $source\n";
		importUMLSTerms( $sab, $umlsCollectionId, $collectionId, $languageId, $isoLanguages );
		$i++;
	}
	
	echo "Importing UMLS definitions per source\n";
	$i = 1;
	foreach ( $sourceAbbreviations as $sab => $source ) {
		echo "  $i: $sab - $source\n";
		importUMLSDefinitions( $sab, $umlsCollectionId, $result->sourceAbbreviations[$sab], $languageId );
		$i++;
	}
	
	echo "Importing UMLS relation types\n";
	importUMLSRelationTypes( $relationCollectionId, $languageId );
	
	echo "Importing UMLS attribute types\n";
	importUMLSRelationAttributes( $relationAttributesCollectionId, $languageId );
	
	echo "Importing UMLS relations per source\n";
	$relationCollection = getCollectionContents( $relationCollectionId );
	$relationAttributesCollection = getCollectionContents( $relationAttributesCollectionId );
	$i = 1;
	
	foreach ( $sourceAbbreviations as $sab => $source ) {
		echo "  $i: $sab - $source\n";
		
		$query = "select cui1, cui2, rel from MRREL where sab like '$sab'";
		importUMLSRelations( $umlsCollectionId , $relationCollection, $query );
		
		$query = "select cui1, cui2, rela from MRREL where sab like '$sab' and rela!=''";
		importUMLSRelations( $umlsCollectionId , $relationAttributesCollection, $query );
		$i++;
	}
	
	echo "Importing semantic network types\n";
	importSNTypes( $semanticNetworkSemanticTypesCollectionId, "SELECT semtypeab,type,definition FROM srdef WHERE type='STY'", $languageId );
	importSNTypes( $semanticNetworkRelationTypesCollectionId, "SELECT semtypeab,type,definition FROM srdef WHERE type='RL'", $languageId );
	
	echo "Importing semantic network relations\n";
	importSemanticTypeRelations( $semanticNetworkSemanticTypesCollectionId, $relationCollection, "SELECT SEMTYPE1, RELATION, SEMTYPE2 from semtypehier" );
	importSemanticTypeRelations( $semanticNetworkRelationTypesCollectionId, $relationCollection, "SELECT RELTYPE1, RELATION, RELTYPE2 from semrelhier" );
	
	echo "Importing UMLS semantic type relations per source\n";
	$attributeTypes = getCollectionContents( $semanticNetworkSemanticTypesCollectionId );
	$i = 1;
	foreach ( $sourceAbbreviations as $sab => $source ) {
		echo "  " . $i++ . ": $sab - $source\n";
		importUMLSSemanticTypes( $sab, $umlsCollectionId, $attributeTypes );
	}
	
	return $result;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:83,代码来源:UMLSImport.php

示例14: openDatabase

if (isset($_POST['name']) && isset($_POST['points'])) {
    // GET Name and points from POST and add to Database
    $name = $_POST['name'];
    $points = $_POST['points'];
    $db = openDatabase();
    $query = 'INSERT INTO highscore (username, playerpoints) VALUES (?,?)';
    $exec = $db->prepare($query);
    $exec->bindParam(1, $name);
    $exec->bindParam(2, $points);
    $exec->execute();
    $data = array('response' => true);
    $response = json_encode($data);
    echo $response;
}
if (isset($_POST['highscore'])) {
    $db = openDatabase();
    $query = 'SELECT * FROM highscore ORDER BY playerpoints DESC';
    $exec = $db->prepare($query);
    $exec->execute();
    $result = $exec->fetchAll(PDO::FETCH_ASSOC);
    $exec = NULL;
    $db = NULL;
    $data = array('data' => $result);
    $response = json_encode($data);
    echo $response;
}
function openDatabase()
{
    try {
        $db = new PDO('mysql:host=localhost;dbname=flux', 'root', '');
    } catch (PDOException $e) {
开发者ID:benblub,项目名称:flux,代码行数:31,代码来源:highscore.php

示例15: microtime

 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
$jmtime = microtime();
$jmtime = explode(" ", $jmtime);
$jmtime = $jmtime[1] + $jmtime[0];
$jmstarttime = $jmtime;
ob_start("ob_gzhandler");
require "/home/winbolo/php/db.php";
#Header stuff
header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Pragma: no-cache");
// HTTP/1.0
require "{$BASE_FILES}/functions.php";
require "{$WWW_ROOT}/wbn/wbn-gameend.php";
openDatabase(true);
#Check session stuff
define('IN_PHPBB', true);
$phpbb_root_path = "{$WWW_ROOT}/forums/";
include $phpbb_root_path . 'extension.inc';
include $phpbb_root_path . 'common.' . $phpEx;
//
// Set page ID for session management
//
$userdata = session_pagestart($user_ip, PAGE_LOGIN);
init_userprefs($userdata);
//
// End session management
//
define('IN_PHPBB', false);
开发者ID:andrewroth,项目名称:winbolo,代码行数:31,代码来源:header.php


注:本文中的openDatabase函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。