本文整理汇总了PHP中openDB函数的典型用法代码示例。如果您正苦于以下问题:PHP openDB函数的具体用法?PHP openDB怎么用?PHP openDB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了openDB函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PHPTutorials
function PHPTutorials()
{
//echo$ip=getIp();
echo "\n<div class='container_fluid'>\n<center><table width='800'>\n <tr>";
openDB();
$getPro_id = mysql_query("select * from products where product_link='php.php'");
$split = 0;
while ($row_pro = mysql_fetch_array($getPro_id)) {
$prod_id = $row_pro['product_id'];
$prod_title = $row_pro['product_title'];
$prod_price = $row_pro['product_price'];
$prod_image = $row_pro['product_image'];
$pro_desc = $row_pro['product_desc'];
$split++;
echo "\n\t\t\t\t\t\t<td width='400' style='padding:5px;'><h3>{$prod_title}</h3>\n\t\t\t\t\t\t<br>\n\t\t\t\t\t\t<a href='../pages/details2.php?pro_id={$prod_id}'>\n\t\t\t\t\t\t<br>\n\t\t\t\t\t\t<image src='../Images/{$prod_image}' width='200' height='100'></image></a>\n\t\t\t\t\t\t<br>\n\t\t\t\t\t\t<h4><strong>Price: \$ {$prod_price}</strong></h4>\n\t\t\t\t\t\t<br><br><h4>Description:</h4><br>{$pro_desc}<br><br>\n\t\t\t\t\t\t<a href='../pages/details2.php?pro_id={$prod_id}'>Details</a>\n\t\t\t\t\t\t<a href='http://www.smcleodtech.com.au/index.php?add_cart={$prod_id}'>\n\t\t\t\t\t\t<button>Add to Cart</button></a></td>";
if ($split % 3 == 0) {
echo "\n\t\t\t\t\t\t</tr><tr>";
}
}
cart();
closeDB();
echo "</tr><br>\n </table></center>\n </div>";
}
示例2: checkTypeUser
function checkTypeUser($user, $password)
{
$bd = openDB();
$retorn = false;
if ($bd != false) {
$sql = $bd->prepare("SELECT `idTypeUser` FROM `users` WHERE userName = ? AND password = ?");
$sql->bindParam(1, $user, PDO::PARAM_STR);
$sql->bindParam(2, $password, PDO::PARAM_STR);
$sql->execute();
$resultat = $sql->fetchAll(PDO::FETCH_ASSOC);
if ($resultat) {
foreach ($resultat as $fila) {
foreach ($fila as $valor) {
$retorn = $valor;
}
}
//$retorn = $idCicle;
echo "Valor de Retorn: " . $retorn;
} else {
//echo "FAIL - ID CURS: ".$idCourse;
$retorn = false;
}
}
$bd = null;
return $retorn;
}
示例3: saveToDB
function saveToDB()
{
$db = openDB();
//Patient table
$patientSQL = $db->prepare('INSERT INTO Patient (
patient_insee, patient_firstName, patient_lastName, patient_dateOfBirth, patient_sex, patient_size, patient_weight,
patient_typeOfID, patient_insurancePlanIdentification, patient_countryOfResidence)
VALUES (
:insee, :firstName, :lastName, :dateOfBirth, :sex, :size, :weight,
\'INSEE\', \'INSEE\', :countryOfResidence)
ON DUPLICATE KEY UPDATE
patient_firstName=:firstName,
patient_lastName=:lastName,
patient_dateOfBirth=:dateOfBirth,
patient_sex=:sex,
patient_size=:size,
patient_weight=:weight,
patient_countryOfResidence=:countryOfResidence;');
$patientSQL->execute(array('insee' => $_SESSION['patient_insee'], 'firstName' => $_SESSION['patient_firstName'], 'lastName' => $_SESSION['patient_lastName'], 'dateOfBirth' => $_SESSION['patient_dateOfBirth'], 'sex' => $_SESSION['patient_sex'], 'size' => $_SESSION['patient_size'], 'weight' => $_SESSION['patient_weight'], 'countryOfResidence' => $_SESSION['patient_countryOfResidence']));
$patientSQL->closeCursor();
$examenSQL = $db->prepare('INSERT INTO Examen (
examen_instanceCreationDateTime,
examen_procedureCodeSequence,
examen_institutionalDepartementName,
examen_protocolName,
examen_performedProcedureStepID,
examen_performedProcedureStepDescription,
examen_contentDateTime,
examen_instanceCreatorUID,
bodyPart_anatomicRegionSequence,
anatomicOrientation_name,
posture_name,
operateur_name,
realisateur_performingPhysicianName,
prescripteur_referringPhysicianName,
patient_insee)
VALUES (
:time,
\'DEFAULT PROCEDURE CODE SEQUENCE\',
\'TODO\',
\'DEFAULT PROTOCOL\',
\'DEFAULT PROCEDURE STEP ID\',
\'DEFAULT PROCEDURE STEP DESCRIPTION\',
:time,
\'DEFAULT INSTANCE CREATOR UID\',
:bodyPart,
:anatomicOrientation,
:posture,
:operateur,
:realisateur,
:prescipteur,
:insee
);');
$examenSQL->execute(array('time' => date("Y-m-d H:i:s"), 'bodyPart' => $_SESSION['examen_bodyPart'], 'anatomicOrientation' => $_SESSION['examen_anatomicOrientation'], 'posture' => $_SESSION['examen_posture'], 'operateur' => $_SESSION['medic_operateur'], 'realisateur' => $_SESSION['medic_prescripteur'], 'prescipteur' => $_SESSION['medic_realisateur'], 'insee' => $_SESSION['patient_insee']));
$examenSQL->closeCursor();
}
示例4: main
function main()
{
global $wonitorDb;
$db = openDB($wonitorDb);
try {
queryDB($db);
} catch (PDOException $e) {
echo $e->getMessage();
}
closeDB($db);
}
示例5: getStudentsCourseCollect
function getStudentsCourseCollect($idCourse)
{
$bd = openDB();
$retorn = false;
if ($bd != false) {
//En funció del curs..
if ($idCourse == 100) {
$sql = $bd->prepare("SELECT idStudent, studentName FROM students WHERE idCourseCollect = 101 OR idCourseCollect = 102");
} else {
if ($idCourse == 200) {
$sql = $bd->prepare("SELECT idStudent, studentName FROM students WHERE idCourseCollect = 201 OR idCourseCollect = 202");
} else {
if ($idCourse == 300) {
$sql = $bd->prepare("SELECT idStudent, studentName FROM students WHERE idCourseCollect = 301 OR idCourseCollect = 302");
} else {
if ($idCourse == 400) {
$sql = $bd->prepare("SELECT idStudent, studentName FROM students WHERE idCourseCollect = 401 OR idCourseCollect = 402 OR idCourseCollect = 403");
} else {
if ($idCourse == 500) {
$sql = $bd->prepare("SELECT idStudent, studentName FROM students WHERE idCourseCollect = 501 OR idCourseCollect = 502");
} else {
if ($idCourse == 600) {
$sql = $bd->prepare("SELECT idStudent, studentName FROM students WHERE idCourseCollect = 601 OR idCourseCollect = 602");
} else {
return false;
}
}
}
}
}
}
$sql->execute();
$resultat = $sql->fetchAll(PDO::FETCH_ASSOC);
if ($resultat) {
$retorn = $resultat;
} else {
echo "FAIL - ID CURS: " . $idCourse;
$retorn = false;
}
}
$bd = null;
return $retorn;
}
示例6: consultaDades
function consultaDades($request, $data1, $data2)
{
$connexio = openDB();
if ($connexio) {
$var = 1;
if ($request == 1) {
//M'he quedat aquí, que no està gaire clar com fer la continuació sense reescriure les mateixes funcions.
//$codiSql = 'SELECT count(b.idBookData) as idBookData FROM studentbookcollect AS sbc INNER JOIN books AS b ON sbc.idBook = b.idBook WHERE sbc.idStudent = ?';
$codiSql = 'SELECT b.idBookData FROM studentbookcollect AS sbc INNER JOIN books AS b ON sbc.idBook = b.idBook WHERE sbc.idStudent = ?';
$consulta = $connexio->prepare($codiSql);
$consulta->bindParam(1, $data1, PDO::PARAM_INT);
//ID Estudiant.
} else {
if ($request == 2) {
$codiSql = 'SELECT `idBookState` FROM `books` WHERE `idBookData` = ? AND `bookNumber` = ?';
$consulta = $connexio->prepare($codiSql);
$consulta->bindParam(1, $data1, PDO::PARAM_INT);
$consulta->bindParam(2, $data1, PDO::PARAM_INT);
}
}
$consulta->execute();
$resultat = $consulta->fetchAll(PDO::FETCH_ASSOC);
//print_r($resultat);
if ($resultat) {
//Si troba dades
return $resultat;
} else {
if (!$resultat) {
//Si es null
return 5;
} else {
if ($connexio) {
//Si la connexió falla
return 4;
} else {
//Si passa alguna cosa que ni Déu sap que collons ha passat, passem per aquí :D
return false;
}
}
}
}
}
示例7: userRegister
function userRegister($first, $last, $user, $e, $pass)
{
$dbh = openDB();
$stmt = $dbh->prepare("INSERT INTO users (first_name, last_name,username,email,password,signup_date) VALUES (:first_name, :last_name,:username,:email,:password,:signup)");
$stmt->bindParam(':first_name', $first_name);
$stmt->bindParam(':last_name', $last_name);
$stmt->bindParam(':username', $username);
$stmt->bindParam(':email', $email);
$stmt->bindParam(':password', $password);
$stmt->bindParam(':signup', $signup_date);
// insert one row
$first_name = $first;
$last_name = $last;
$username = $user;
$email = $e;
$password = $pass;
$signup_date = time();
$stmt->execute();
$dbh = null;
}
示例8: getChunkData
function getChunkData($space)
{
$db =& openDB();
$sql = "SELECT id,name,s_lat,s_long FROM sites WHERE half_degree_index=?";
$res =& $db->query($sql, array($space));
if (DB::isError($res)) {
die("query " . $res->getMessage());
}
ob_start();
print "{\r\n contains: \"{$space}\",\r\n";
print " \"{$space}\": [ \r\n";
$count = 0;
while ($row =& $res->fetchRow()) {
$name = str_replace("\"", "\"\"", $row['name']);
if ($count++ > 0) {
print ",\r\n";
}
print " {i: \"{$row['id']}\", lt: {$row['s_lat']}, ln: {$row['s_long']}, name: \"" . htmlspecialchars($name) . "\" }";
}
print "\r\n ]\r\n}";
$data = ob_get_contents();
ob_end_clean();
return $data;
}
示例9: ini_set
ini_set('display_startup_errors', 1);
require_once 'dbUtil.php';
function info($stringy)
{
echo 'Info: ' . $stringy . '<br \\>';
}
function warning($string)
{
echo 'Warning: ' . $string . '<br \\>';
}
function error($string)
{
die('Error: ' . $string);
}
// rounds.sqlite3
if (databaseExists($wonitorDb)) {
try {
$db = openDB($wonitorDb);
$query = 'SELECT COUNT(1) as count FROM rounds WHERE averageSkill<0';
$numentries = $db->query($query, PDO::FETCH_NUM)->fetchAll(PDO::FETCH_COLUMN, 0)[0];
if ($numentries != 0) {
info('Found rounds with negative averageSkil. Will set them to 0 now.');
$query = 'UPDATE rounds SET averageSkill=0 WHERE averageSkill<0';
$db->query($query, PDO::FETCH_NUM);
}
closeDB($db);
} catch (PDOException $e) {
warning($e->getMessage());
}
}
echo 'All done.';
示例10: ob_end_flush
ob_end_flush();
$login_output .= $login_preamble;
$login_output .= "<div class='alert alert-warning'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button><p><strong>Whoops!</strong> " . $res['message'] . "</p><aside class='ssmall'>Did you mean to <a href='?q=create' class='alert-link'>create a new account instead?</a> Or did you need to <a href='#' class='alert-link do-password-reset'>reset your password?</a></aside>\n<p class='small'>As a reminder, we require a password of at least {$minimum_password_length} characters with at least <strong>one upper case</strong> letter, at least <strong>one lower case</strong> letter, and at least <strong>one digit or special character</strong>.</p>\n </div>";
$failcount = intval($_POST['failcount']) + 1;
$loginform_whole = $loginform . "\n <input type='hidden' name='failcount' id='failcount' value='{$fail}'/>" . $loginform_close;
if ($failcount < 10) {
$login_output .= $loginform_whole;
} else {
$result = lookupItem($_POST['username'], 'username', null, null, false, true);
if ($result !== false) {
$userdata = mysqli_fetch_assoc($result);
$id = $userdata['id'];
}
$query = "UPDATE `{$default_user_table}` SET dtime=" . $user->microtime_float() . " WHERE id={$id}";
$query2 = "UPDATE `{$default_user_table}` SET disabled=true WHERE id={$id}";
$l = openDB();
$result1 = mysqli_query($l, $query);
if (!$result1) {
echo "<div class='alert alert-warning'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button><p>" . mysqli_error($l) . "</p></div>";
} else {
$result2 = execAndCloseDB($l, $query2);
if (!$result2) {
echo "<div class='alert alert-warning'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button><p>" . mysqli_error($l) . "</p></div>";
} else {
$login_output .= "<div class='alert alert-danger'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button><p><strong>Sorry, you've had ten failed login attempts.</strong> Your account has been disabled for 1 hour.</p></div>";
}
}
}
}
}
} else {
示例11: UserSession
$oModBase->loadLibrary('menu');
$oModBase->loadLibrary('session');
$oModBase->loadLibrary('componentes');
$oModBase->loadLibrary('window');
//$oModBase->loadLibrary('mapa');
if ( MODO_ADMIN === true)
$oModBase->loadLibrary('interfaces');
else
$oModBase->addHeadFile( 'templates/style_inc.php' );
$aModule[$cModule]->copy( &$oModBase , false );
$aModule[$cModule]->oUserSession = new UserSession();
$aModule[$cModule]->oMenu = new Menu( 'body_main' );
$aModule[$cModule]->bPermisosDB = true;
//$aModule[$cModule]->oDatabase = openDB( DB_MYSQL, 'localhost', 'librosar', 'cal', 'isbn1982');
$aModule[$cModule]->oDatabase = openDB( DB_MYSQL, 'localhost', 'git', 'root', 'c4r4m3l0');
$aModule[$cModule]->oDatabase->connect();
$aModule[$cModule]->addStyleSheet( "bue.css" );
$aModule[$cModule]->setTemplateHead( $oModBase->getTemplateHead() );
$ncMenu = getParam(ncMenu, START_MENU);
global $aMenu ;
require_once( PATH_MODULES . '/portal/componentes_lib.php');
$aMenu = traer_menu( $aModule[$cModule]->oDatabase, $oModBase->getLanguage() , $ncMenu) ;
if ( $nMenu && $nSeccion )
$aMenu[cdSeccion] = extractLanguage($aModule[$cModule]->oDatabase->getData("SELECT cdMenu FROM gtMenu WHERE ncMenu = $nSeccion"), $aModule[$cModule]->getLanguage() );;
if ( $nMenu && $nOrden )
$aMenu[dSubseccion] = extractLanguage($aModule[$cModule]->oDatabase->getData("SELECT cdMenu FROM gtMenu WHERE ncMenu = $nMenu"), $aModule[$cModule]->getLanguage() );;
// Define las constantes del la contrasena
示例12: performQuery
function performQuery($query)
{
// Open the database.
$db = openDB();
// Query the database.
$queryResult = mysql_query($query, $db);
// If there is an error, return the error.
if (!$queryResult) {
$result = array("status" => 0, "error" => array("6", "Database query error: " . mysql_error()));
packageResponse($result);
exit;
}
// Close the database and return the result.
closeDB($db);
return $queryResult;
}
示例13: openDB
<?php
require "../libraries/dbLibrary.php";
require "../php/password.php";
$mysqli = openDB("localhost", "{$utente}", "{$pass}", "organico_miur");
示例14: session_start
<?php
session_start();
include_once 'convenience_functions.php';
$db = openDB();
//include_once('convenience_functions.php');
// On définit le nombre de série dans la séquence
if (!isset($_SESSION['serie'])) {
$_SESSION['serie'] = 1;
} else {
$_SESSION['serie'] = $_SESSION['serie'] + 1;
}
/*Ouverture du fichier en lecture seule*/
$dir = $_SESSION['examen'];
$serie = 'serie_' . $_SESSION['serie'];
$fichier = 'lecture_serial.txt';
// Création du dossier série
if (!is_dir($dir . '/' . $serie)) {
mkdir($dir . '/' . $serie);
}
//$path=$dir.'/'.$serie.'/'.$fichier; //chemin d'accès au fichier à utiliser quand l'enregistrement du signal fonctionnera
$path = $fichier;
// ligne a supprimer quand l'enregistrement signal fonctionnera
$path_img = $dir . '/' . $serie . '/images';
// Création dossier image
if (!is_dir($path_img)) {
mkdir($path_img);
}
$date = date("Y-m-d");
// INCREMENTER study_aquisitionsInStudy
$studySQL = $db->prepare('UPDATE Study
示例15: registerRoutine
function registerRoutine($language)
{
global $config;
/**********
* Open DB
**********/
$db = openDB();
/**********
* Generate an ID
**********/
$unique = false;
// in theory a collision could happen, though unlikely. So just to make sure, we do this
// since that would really suck
while (!$unique) {
$id = date("ymd") . rand(1000, 9999);
$uniqueQuery =& $db->Execute("SELECT sysid.sysid_id\n FROM sysid\n WHERE sysid.sysid_id = '{$id}'\n ");
if (!$uniqueQuery) {
return new serverReturn(false, 'SERVER', 'Database Error R1');
}
$numRows = $uniqueQuery->RecordCount();
if ($numRows == 0) {
// It's unique, stop the loop.
$unique = true;
}
}
/**********
* Register ID
**********/
$addSysIdQuery = $db->Execute("INSERT INTO sysid (\n sysid.sysid_id,\n sysid.sysid_created,\n sysid.sysid_created_ip,\n sysid.sysid_language\n )\n VALUES (\n '" . $id . "',\n now(),\n " . $db->quote($_SERVER['REMOTE_ADDR']) . ",\n " . $db->quote($language) . "\n )");
if (!$addSysIdQuery) {
return new serverReturn(false, 'SERVER', 'Database Error R2');
}
/**********
* Disconnect
**********/
$db->disconnect();
return new serverReturn(true, 'SERVER', $id);
}