本文整理汇总了PHP中ConfigManager::getDatabase方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigManager::getDatabase方法的具体用法?PHP ConfigManager::getDatabase怎么用?PHP ConfigManager::getDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigManager
的用法示例。
在下文中一共展示了ConfigManager::getDatabase方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
function login($username, $password)
{
$ConfigManager = new ConfigManager();
$dbhost = $ConfigManager->getHost();
$dbuser = $ConfigManager->getUser();
$dbname = $ConfigManager->getDatabase();
$dbpass = $ConfigManager->getPassword();
$conn = null;
try {
$conn = new PDO("mysql:host={$dbhost};dbname={$dbname}", $dbuser, $dbpass);
$cmd = "\n\t\t\t\tSELECT \t\n\t\t\t\t\tid as id_operatore,\n\t\t\t\t\tusername as username_operatore,\n\t\t\t\t\tpassword as password_operatore,\n\t\t\t\t\tdescrizione as descrizione_operatore\n\t\t\t\tFROM \trusc_operatori \n\t\t\t\tWHERE \tusername = :username\n\t\t\t\t\t\tAND password = :password";
$result = $conn->prepare($cmd);
$result->bindValue(":username", $username);
$result->bindValue(":password", $password);
$result->execute();
$return_arr = array();
$row_array = array();
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$row_array['idOperatore'] = utf8_encode($row['id_operatore']);
$row_array['usernameOperatore'] = utf8_encode($row['username_operatore']);
$row_array['descrizioneOperatore'] = utf8_encode($row['descrizione_operatore']);
array_push($return_arr, $row_array);
}
$conn = NULL;
return json_encode($return_arr);
} catch (PDOException $e) {
return json_encode($e->getMessage());
}
}
示例2: connetti_query
function connetti_query($query)
{
global $Host, $User, $Password, $Database, $link;
$ConfigManager = new ConfigManager();
$Host = $ConfigManager->getHost();
$User = $ConfigManager->getUser();
$Database = $ConfigManager->getDatabase();
$Password = $ConfigManager->getPassword();
// Connessione al database
if (!($link = mysql_connect($Host, $User, $Password))) {
die("Errore nella connessione al database! -> " . mysql_error());
}
// Apertura del database
if (!mysql_select_db($Database, $link)) {
die("Errore nell'apertura del database mba!" . mysql_error());
}
// Esucuzione della query
if (!($result = mysql_query($query, $link))) {
print "Errore nell'esecuzione della query! <br />";
die(mysql_error());
}
//chiusura del collegamento al database
mysql_close($link);
//restituzione all'ambiente chiamante del risultato della query
return $result;
}
示例3: elenco
function elenco()
{
$ConfigManager = new ConfigManager();
$dbhost = $ConfigManager->getHost();
$dbuser = $ConfigManager->getUser();
$dbname = $ConfigManager->getDatabase();
$dbpass = $ConfigManager->getPassword();
$conn = null;
try {
$conn = new PDO("mysql:host={$dbhost};dbname={$dbname}", $dbuser, $dbpass);
$cmd = "\r\n\t\t\t\tselect \r\n\t\t\t\t\trusc_tipologia.id as id_tipologia,\r\n\t\t\t\t\trusc_tipologia.codice as codice_tipologia,\r\n\t\t\t\t\trusc_tipologia.descrizione as descrizione_tipologia \r\n\t\t\t\tfrom \r\n\t\t\t\t\trusc_tipologia\r\n\t\t\t\torder by rusc_tipologia.codice";
$result = $conn->prepare($cmd);
$result->execute();
$return_arr = array();
$row_array = array();
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$row_array['idTipologia'] = utf8_encode($row['id_tipologia']);
$row_array['codiceTipologia'] = utf8_encode($row['codice_tipologia']);
$row_array['descrizioneTipologia'] = utf8_encode($row['descrizione_tipologia']);
array_push($return_arr, $row_array);
}
$conn = NULL;
return json_encode($return_arr);
} catch (PDOException $e) {
echo $e->getMessage();
}
}
示例4: elenco
function elenco($idOperatore)
{
$ConfigManager = new ConfigManager();
$dbhost = $ConfigManager->getHost();
$dbuser = $ConfigManager->getUser();
$dbname = $ConfigManager->getDatabase();
$dbpass = $ConfigManager->getPassword();
$conn = null;
try {
$conn = new PDO("mysql:host={$dbhost};dbname={$dbname}", $dbuser, $dbpass);
$cmd = "\r\n\t\t\t\tselect \r\n\t\t\t\t\trusc_conferimenti.id as id_conferimento,\r\n\t\t\t\t\trusc_tipologia.descrizione as descrizione_conferimento, \r\n\t\t\t\t\trusc_conferimenti.data as data_conferimento,\r\n\t\t\t\t\trusc_operatori.descrizione as descrizione_operatore\r\n\t\t\t\tfrom \r\n\t\t\t\t\trusc_conferimenti, \r\n\t\t\t\t\trusc_tipologia,\r\n\t\t\t\t\trusc_operatori\r\n\t\t\t\twhere \r\n\t\t\t\t\trusc_conferimenti.tipologia = rusc_tipologia.id\r\n\t\t\t\t\tand rusc_conferimenti.operatore = rusc_operatori.id\r\n\t\t\t\t\tand rusc_operatori.id = " . $idOperatore;
$result = $conn->prepare($cmd);
$result->execute();
$return_arr = array();
$row_array = array();
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$row_array['idConferimento'] = utf8_encode($row['id_conferimento']);
$row_array['descrizioneConferimento'] = utf8_encode($row['descrizione_conferimento']);
$row_array['dataConferimento'] = utf8_encode($row['data_conferimento']);
$row_array['descrizioneOperatore'] = utf8_encode($row['descrizione_operatore']);
array_push($return_arr, $row_array);
}
$conn = NULL;
return json_encode($return_arr);
} catch (PDOException $e) {
echo $e->getMessage();
}
}
示例5: __construct
public function __construct()
{
$ConfigManager = new ConfigManager();
$this->Host = $ConfigManager->getHost();
$this->User = $ConfigManager->getUser();
$this->Database = $ConfigManager->getDatabase();
$this->Password = $ConfigManager->getPassword();
}
示例6: ConfigManager
<?php
require_once "../ConfigManager.php";
$ConfigManager = new ConfigManager();
$dbhost = $ConfigManager->getHost();
$dbuser = $ConfigManager->getUser();
$dbname = $ConfigManager->getDatabase();
$dbpass = $ConfigManager->getPassword();
$conn = null;
try {
$conn = new PDO("mysql:host={$dbhost};dbname={$dbname}", $dbuser, $dbpass);
$idStagione = $_GET['idStagione'];
$cmd = "\n\t\tselect \n\t\t\tp.ID as ID,\n\t\t\ta.ID as ID_ATLETA,\n\t\t\ta.NOME as NOME_ATLETA, \n\t\t\ta.COGNOME as COGNOME_ATLETA, \n\t\t\tg.ID as ID_GARA,\n\t\t\tg.NOME as NOME_GARA,\n\t\t\tg.LOCALITA as LOCALITA_GARA,\n\t\t\tg.DATA as DATA_GARA,\n\t\t\ttg.ID as ID_TIPOLOGIA_GARA,\n\t\t\ttg.TIPO as TIPOLOGIA_GARA_DESCRIZIONE,\n\t\t\ttg.PUNTEGGIO as TIPOLOGIA_GARA_PUNTEGGIO,\n\t\t\tp.POSIZIONE_ASSOLUTA as POSIZIONE_ASSOLUTA,\n\t\t\tp.TOTALE_ASSOLUTI as TOTALE_ASSOLUTI,\n\t\t\tp.POSIZIONE_CATEGORIA as POSIZIONE_CATEGORIA,\n\t\t\tp.TOTALE_CATEGORIA as TOTALE_CATEGORIA,\n\t\t\tp.BONUS as BONUS,\n\t\t\ts.ID as ID_STAGIONE,\n\t\t\ts.ANNO as ANNO\n\t\tfrom \n\t\t\tpresenza p,\n\t\t\tatleta a,\n\t\t\tgara g,\n\t\t\ttipologia_gara tg,\n\t\t\tstagione s\n\t\twhere \n\t\t\tp.ID_ATLETA = a.ID\n\t\t\tand p.ID_GARA = g.ID\n\t\t\tand p.ID_TIPOLOGIA_GARA = tg.ID\n\t\t\tand p.ID_STAGIONE = s.ID\n\t\t\tand s.ID = " . $idStagione . "\n\t\tgroup by p.ID\n\t\torder by g.DATA desc, g.NOME, a.COGNOME";
$result = $conn->prepare($cmd);
$result->execute();
$return_arr = array();
$row_array = array();
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$row_array['id'] = utf8_encode($row['ID']);
$row_array['idAtleta'] = utf8_encode($row['ID_ATLETA']);
$row_array['nomeAtleta'] = utf8_encode($row['NOME_ATLETA']);
$row_array['cognomeAtleta'] = utf8_encode($row['COGNOME_ATLETA']);
$row_array['idGara'] = utf8_encode($row['ID_GARA']);
$row_array['nomeGara'] = utf8_encode($row['NOME_GARA']);
$row_array['localitaGara'] = utf8_encode($row['LOCALITA_GARA']);
$row_array['dataGara'] = utf8_encode($row['DATA_GARA']);
$row_array['tipologiaGara'] = utf8_encode($row['ID_TIPOLOGIA_GARA']);
$row_array['tipologiaGaraDescrizione'] = utf8_encode($row['TIPOLOGIA_GARA_DESCRIZIONE']);
$row_array['tipologiaGaraPunteggio'] = utf8_encode($row['TIPOLOGIA_GARA_PUNTEGGIO']);
$row_array['posizioneAssoluta'] = utf8_encode($row['POSIZIONE_ASSOLUTA']);
$row_array['totaleAssoluti'] = utf8_encode($row['TOTALE_ASSOLUTI']);
示例7: ConfigManager
<?php
require_once "../ConfigManager.php";
$configManager = new ConfigManager();
//ENTER THE RELEVANT INFO BELOW
$mysqlDatabaseName = $configManager->getDatabase();
$mysqlUserName = $configManager->getUser();
$mysqlPassword = $configManager->getPassword();
$mysqlHostName = $configManager->getHost();
$mysqlExportPath = "../database/backups/db_dump_" . date("Y-m-d") . ".sql";
//DONT EDIT BELOW THIS LINE
//Export the database and output the status to the page
$command = 'mysqldump --opt -h' . $mysqlHostName . ' -u' . $mysqlUserName . ' -p' . $mysqlPassword . ' ' . $mysqlDatabaseName . ' > ~/' . $mysqlExportPath;
exec($command, $output = array(), $worked);
switch ($worked) {
case 0:
echo 'Database <b>' . $mysqlDatabaseName . '</b> successfully exported to <b>~/' . $mysqlExportPath . '</b>';
break;
case 1:
echo 'There was a warning during the export of <b>' . $mysqlDatabaseName . '</b> to <b>~/' . $mysqlExportPath . '</b>';
break;
case 2:
echo 'There was an error during export. Please check your values:<br/><br/><table><tr><td>MySQL Database Name:</td><td><b>' . $mysqlDatabaseName . '</b></td></tr><tr><td>MySQL User Name:</td><td><b>' . $mysqlUserName . '</b></td></tr><tr><td>MySQL Password:</td><td><b>NOTSHOWN</b></td></tr><tr><td>MySQL Host Name:</td><td><b>' . $mysqlHostName . '</b></td></tr></table>';
break;
}
?>