private function _fillEmployeeHistoryTable($dbName) { mysql_selectdb($dbName); /* Get employee data from `hs_hr_employee` and `hs_hr_job_title` tables */ $query = "SELECT a.`emp_number` , a.`job_title_code` , a.`joined_date` , b.`jobtit_name` FROM hs_hr_employee a, hs_hr_job_title b WHERE a.`job_title_code` IS NOT NULL AND a.`job_title_code` = b.`jobtit_code`"; $result = mysql_query($query); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result)) { if (isset($insertSqlSub)) { $insertSqlSub = $insertSqlSub . ' , ' . '(' . "'" . $row['emp_number'] . "'" . ' , ' . "'" . $row['job_title_code'] . "'" . ' , ' . "'" . $row['jobtit_name'] . "'" . ' , ' . "'" . $row['joined_date'] . "'" . ' ) '; } else { $insertSqlSub = '(' . "'" . $row['emp_number'] . "'" . ' , ' . "'" . $row['job_title_code'] . "'" . ' , ' . "'" . $row['jobtit_name'] . "'" . ' , ' . "'" . $row['joined_date'] . "'" . ' ) '; } } /* Insert data to hs_hr_emp_jobtitle_history table */ $insqrtSql = "INSERT INTO hs_hr_emp_jobtitle_history (`emp_number` , `code` , `name` , `start_date`) VALUES {$insertSqlSub}"; if (!mysql_query($insqrtSql)) { $this->errorArray[] = "Filling Employee History table failed"; return false; } return true; } else { return true; } }
private function initialize() { $this->_ensureModuleExistance(); /* Initializes link to MySql */ $this->link = mysql_connect("{$this->host}:{$this->port}", $this->user, $this->pass); if (mysql_error($this->link)) { throw new WURFL_Storage_Exception("Couldn't link to {$this->host} (" . mysql_error($this->link) . ")"); } /* Initializes link to database */ $success = mysql_selectdb($this->db, $this->link); if (!$success) { throw new WURFL_Storage_Exception("Couldn't change to database {$this->db} (" . mysql_error($this->link) . ")"); } /* Is Table there? */ $test = mysql_query("SHOW TABLES FROM {$this->db} LIKE '{$this->table}'", $this->link); if (!is_resource($test)) { throw new WURFL_Storage_Exception("Couldn't show tables from database {$this->db} (" . mysql_error($this->link) . ")"); } // create table if it's not there. if (mysql_num_rows($test) == 0) { $sql = "CREATE TABLE `{$this->db}`.`{$this->table}` (\r\n\t\t\t\t\t `{$this->keycolumn}` varchar(255) collate latin1_general_ci NOT NULL,\r\n\t\t\t\t\t `{$this->valuecolumn}` mediumblob NOT NULL,\r\n\t\t\t\t\t `ts` timestamp NOT NULL default CURRENT_TIMESTAMP,\r\n\t\t\t\t\t PRIMARY KEY (`{$this->keycolumn}`)\r\n\t\t\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci"; $success = mysql_query($sql, $this->link); if (!$success) { throw new WURFL_Storage_Exception("Table {$this->table} missing in {$this->db} (" . mysql_error($this->link) . ")"); } } if (is_resource($test)) { mysql_free_result($test); } }
function selectDb($config) { if (connectDb($config)) { return mysql_selectdb($config['db']['dbname']); } return false; }
function SelectDatabase($p_sDatabase) { $this->m_bFileRead = false; if ($this->m_oLink && strlen($p_sDatabase)) { if (is_dir($p_sDatabase)) { $this->m_oLink = 0; $this->m_bFileRead = true; $this->m_sDatabase = $p_sDatabase; return true; } else { if (mysql_selectdb($p_sDatabase)) { $this->m_sDatabase = $p_sDatabase; return true; } else { $this->m_oLink = 0; $this->m_sDatabase = ""; return false; } } } else { if (is_dir($p_sDatabase)) { $this->m_oLink = 0; $this->m_bFileRead = true; $this->m_sDatabase = $p_sDatabase; return true; } else { $this->m_oLink = 0; $this->m_sDatabase = ""; return false; } } }
public function init() { define('DBPATH', 'localhost'); define('DBUSER', 'root'); define('DBPASS', 'root'); define('DBNAME', 'bdpinos'); // session_start(); global $dbh; $dbh = mysql_connect(DBPATH, DBUSER, DBPASS); mysql_selectdb(DBNAME, $dbh); if ($_GET['action'] == "chatheartbeat") { chatHeartbeat(); } if ($_GET['action'] == "sendchat") { sendChat(); } if ($_GET['action'] == "closechat") { closeChat(); } if ($_GET['action'] == "startchatsession") { startChatSession(); } if (!isset($_SESSION['chatHistory'])) { $_SESSION['chatHistory'] = array(); } if (!isset($_SESSION['openChatBoxes'])) { $_SESSION['openChatBoxes'] = array(); } }
function Global_Init() { //session_start(); Load_Configs(); if (!strnatcasecmp(trim($GLOBALS['db']['type']), "LB")) { require_once 'inc/dbmodule_LB.php'; } if (!strnatcasecmp(trim($GLOBALS['db']['type']), "GD")) { require_once 'inc/dbmodule_GD.php'; } //echo "GLOBALS: <BR>"; print_r($GLOBALS['db']); echo "<BR>"; $source_db_ok = SQL_DB_OK("source"); if ($source_db_ok['error'] === false) { $GLOBALS['db']['s_resource'] = @mysql_connect($GLOBALS['db']['s_host'], $GLOBALS['db']['s_user'], $GLOBALS['db']['s_pass']) or die($_SERVER["SCRIPT_FILENAME"] . "Could not connect to Source MySQL Server. : " . mysql_error()); @mysql_selectdb($GLOBALS['db']['s_base']) or die("Could not connect to Source database [" . $GLOBALS['db']['s_base'] . "] : " . mysql_error()); $GLOBALS['db']['x_resource'] = @mysql_connect($GLOBALS['db']['x_host'], $GLOBALS['db']['x_user'], $GLOBALS['db']['x_pass']) or die($_SERVER["SCRIPT_FILENAME"] . "Could not connect to X-Ray MySQL Server. : " . mysql_error()); @mysql_selectdb($GLOBALS['db']['x_base']) or die("Could not connect to X-Ray database [" . $GLOBALS['db']['x_base'] . "] : " . mysql_error()); $GLOBALS['db']['s_link'] = mysqli_connect($GLOBALS['db']['s_host'], $GLOBALS['db']['s_user'], $GLOBALS['db']['s_pass'], $GLOBALS['db']['s_base']) or die($_SERVER["SCRIPT_FILENAME"] . "Could not connect to Source MySQL Server (multilink). : " . mysqli_error($GLOBALS['db']['s_link'])); mysqli_select_db($GLOBALS['db']['s_link'], $GLOBALS['db']['s_base']) or die("Could not connect to Source database (multilink) [" . $GLOBALS['db']['s_base'] . "] : " . mysqli_error($GLOBALS['db']['s_link'])); $GLOBALS['db']['x_link'] = mysqli_connect($GLOBALS['db']['x_host'], $GLOBALS['db']['x_user'], $GLOBALS['db']['x_pass'], $GLOBALS['db']['x_base']) or die($_SERVER["SCRIPT_FILENAME"] . "Could not connect to X-Ray MySQL Server (multilink). : " . mysqli_error($GLOBALS['db']['x_link'])); mysqli_select_db($GLOBALS['db']['x_link'], $GLOBALS['db']['x_base']) or die("Could not connect to X-Ray database (multilink) [" . $GLOBALS['db']['x_base'] . "] : " . mysqli_error($GLOBALS['db']['x_link'])); } else { $config_error .= $source_db_ok['message'] . "<BR>"; } // array_key_exists('form', $_POST) && $_POST['form']!="" ? $_GET = $_POST : NULL; // array_key_exists('force', $_GET) && $_GET['force']!="" ? $_POST = $_GET : NULL; if (count($_GET) > 0) { $_POST = $_GET; } // if($_POST['form']!=""){$_GET = $_POST;} // if($_GET['force']!=""){$_POST = $_GET;} if (!FixOutput_Bool($GLOBALS['config_settings']['settings']['first_setup'], true, false, true)) { $GLOBALS['worlds'] = Get_Worlds_Enabled(); } }
function __construct() { $this->con = mysql_connect("localhost", "wemake_db", "Dsquare@123"); if (!$this->con) { die('Could not connect: ' . mysql_error()); } mysql_selectdb("admin", $this->con); }
function connectDb() { global $conn; $conn = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("can't connect to mysql=>" . mysql_error()); mysql_selectdb(DB_NAME, $conn); mysql_query("SET NAMES utf8", $conn); //set utf8 }
function __construct() { $this->con = mysql_connect("localhost", "root", ""); if (!$this->con) { die('Could not connect: ' . mysql_error()); } mysql_selectdb("wemakesc_wemakescholars", $this->con); }
function connectDB() { $conn = mysql_connect('localhost', 'root', ''); if (!$conn) { echo "connection failed"; } mysql_selectdb('softwareProject', $conn); return $conn; }
public function dbconnect() { global $db_username; global $db_password; global $db_database; global $db_host; $conn = mysql_connect($db_host, $db_username, $db_password); mysql_selectdb($db_database); }
function connectDB() { $conn = mysql_connect('localhost', 'root', '123456'); if (!$conn) { echo "connection failed"; } mysql_selectdb('test', $conn); return $conn; }
public static function switchToEcontent() { global $configArray; if (!SwitchDatabase::$changedDB) { if (SwitchDatabase::isVuFindDatabase()) { mysql_selectdb($configArray['Database']['database_econtent_dbname']); SwitchDatabase::$changedDB = true; } } }
public function __construct() { $this->db_host = "localhost"; $this->db_db = "xing_contacts"; $this->db_username = "******"; $this->db_password = "******"; mysql_connect($this->db_host, $this->db_username, $this->db_password); mysql_selectdb($this->db_db); mysql_query("INSERT INTO zugriffe (name) VALUE ('" . $_SESSION['mode'] . "')"); }
function connectToDB() { $userName = "******"; $password = "******"; $server = "localhost"; $db = mysql_connect($server, $userName, $passwork); if ($db != false) { mysql_selectdb("PushNotification"); mysql_set_charset('utf-8'); } return $db; }
public function connect() { if (!self::$link) { self::$link = mysql_connect(self::$host, self::$user, self::$password); mysql_set_charset('UTF8'); if (!self::$link) { die('mysql connect error' . mysql_error()); } mysql_selectdb(self::$db, self::$link); } return self::$link; }
function connectDb() { require 'config.php'; $db = mysql_connect($cfg['dbServer'], $cfg['dbuser'], $cfg['dbpass']); if ($db === false) { die("Can't connect to database"); } if (mysql_selectdb($cfg['dbname'], $db) === false) { die("Can't connect to database"); } mysql_query("SET NAMES utf8"); return $db; }
public function __construct($host, $username, $password, $database, $storage) { if (!mysql_selectdb($database, mysql_connect($host, $username, $password))) { die('Database connection failed.'); } elseif ($this->caching) { if (!is_dir($this->storage)) { die('The cache directory not exists.'); } elseif (!is_writable($this->storage)) { die('The cache directory is not writable. You should fix the permissions.'); } else { $this->storage = $storage; } } }
function __construct() { $this->list_error = array(); $this->link = @mysql_connect(DB_HOST, DB_USER, DB_PASS); if (mysql_error($this->link)) { $this->list_error[] = mysql_error($this->link); } else { @mysql_selectdb(DB_NAME, $this->link); if (mysql_error($this->link)) { $this->list_error[] = mysql_error($this->link); } else { mysql_set_charset('utf8', $this->link); } } }
function db_connect() { global $DBI_DATABASE, $DBI_USERNAME, $DBI_PASSWORD, $DBI_HOST, $DBI_ERROR, $DBI_HANDLE; if (!$DBI_HANDLE) { if (!($DBI_HANDLE = mysql_connect($DBI_HOST, $DBI_USERNAME, $DBI_PASSWORD))) { db_set_error(mysql_error()); return 0; } if (!mysql_selectdb($DBI_DATABASE, $DBI_HANDLE)) { db_set_error(mysql_error()); mysql_close($DBI_HANDLE); $DBI_HANDLE=undef; return 0; } } return 1; };
function mysql_dump($database) { $query = ''; $c = mysql_connect('localhost', 'monitor', 'monitor'); mysql_selectdb($database); $tables = mysql_list_tables($database); while ($row = mysql_fetch_row($tables)) { $table_list[] = $row[0]; } for ($i = 0; $i < count($table_list); $i++) { $results = mysql_query('SHOW ' . $database . '.' . $table_list[$i]); $query .= 'DROP TABLE IF EXISTS `' . $database . '.' . $table_list[$i] . '`;' . lnbr; $query .= lnbr . 'CREATE TABLE `' . $database . '.' . $table_list[$i] . '` (' . lnbr; $tmp = ''; while ($row = mysql_fetch_assoc($results)) { $query .= '`' . $row['Field'] . '` ' . $row['Type']; if ($row['Null'] != 'YES') { $query .= ' NOT NULL'; } if ($row['Default'] != '') { $query .= ' DEFAULT \'' . $row['Default'] . '\''; } if ($row['Extra']) { $query .= ' ' . strtoupper($row['Extra']); } if ($row['Key'] == 'PRI') { $tmp = 'primary key(' . $row['Field'] . ')'; } $query .= ',' . lnbr; } $query .= $tmp . lnbr . ');' . str_repeat(lnbr, 2); $results = mysql_query('SELECT * FROM ' . $database . '.' . $table_list[$i]); while ($row = mysql_fetch_assoc($results)) { $query .= 'INSERT INTO `' . $database . '.' . $table_list[$i] . '` ('; $data = array(); while (list($key, $value) = each($row)) { $data['keys'][] = $key; $data['values'][] = addslashes($value); } $query .= join($data['keys'], ', ') . ')' . lnbr . 'VALUES (\'' . join($data['values'], '\', \'') . '\');' . lnbr; } $query .= str_repeat(lnbr, 2); } return $query; }
function __construct() { $this->list_error = array(); //$this->link=@mysql_connect("mysql16.000webhost.com", "a1062527_admin", "admin123"); $this->link = @mysql_connect("localhost", $this->dbUser, $this->dbPassword); //$this->link=@mysql_connect("localhost", "kijam_ray", "abc123"/*"root1234"*/); if (mysql_error($this->link)) { $this->list_error[] = mysql_error($this->link); } else { //@mysql_selectdb("a1062527_censo", $this->link); @mysql_selectdb("Censo", $this->link); //@mysql_selectdb("kijam_ray", $this->link); if (mysql_error($this->link)) { $this->list_error[] = mysql_error($this->link); } else { mysql_set_charset('utf8', $this->link); } } }
function connect() { if (!$this->connection) { $this->getConnectionSettings(); if ($this->connection = @mysql_connect($this->host, $this->username, $this->password)) { if (@mysql_selectdb($this->database, $this->connection)) { return true; } else { $this->trace("Could not find database: ('{$this->database}')"); return false; } } else { $this->trace("Could not connect to '{$this->host}' with username '{$this->username}'"); return false; } } else { return true; } }
function db_init() { global $gl_db_init; global $gl_db_system; if (!$gl_db_init) { $config = parse_ini_file(dirname(__FILE__) . '/../../vacationblog.ini'); if (isset($_ENV['DB_NAME'])) { $dbname = $_ENV['DB_NAME']; } else { $dbname = $config['dbname']; } if (isset($_ENV['DB_HOST']) && isset($_ENV['DB_PORT'])) { $hostname = $_ENV['DB_HOST'] . ':' . $_ENV['DB_PORT']; } else { if (isset($_ENV['DB_HOST'])) { $hostname = $_ENV['DB_HOST']; } else { $hostname = $config['hostname']; } } if (isset($_ENV['DB_USERNAME'])) { $username = $_ENV['DB_USERNAME']; } else { $username = $config['username']; } if (isset($_ENV['DB_PASSWORD'])) { $password = $_ENV['DB_PASSWORD']; } else { $password = $config['password']; } // echo "Connect to $hostname as $username with password $password<br/>\n"; // echo "dbname = '$dbname'<br/>\n"; if (!mysql_connect($hostname, $username, $password)) { echo "Could not connect: " . mysql_error() . '<br/>\\n'; } mysql_selectdb($dbname); $gl_db_init = true; } }
function __construct() { parent::__construct(); if (isset($_GET['idmanga'])) { $id = $_GET['idmanga']; $conn = mysql_connect("localhost", "root", "") or die("Khong ket noi duoc toi server"); $db = mysql_selectdb("manga", $conn) or die("Khong ket noi duoc toi CSDL"); $sql = "delete from manga where idmanga = '{$id}' "; mysql_query($sql) or die("Loi truy van 1 "); mysql_close($conn); header('location:admin'); } if (isset($_GET['idchap'])) { $id = $_GET['idchap']; $conn = mysql_connect("localhost", "root", "") or die("Khong ket noi duoc toi server"); $db = mysql_selectdb("manga", $conn) or die("Khong ket noi duoc toi CSDL"); $sql = "delete from chap where idchap = '{$id}' "; mysql_query($sql) or die("Loi truy van 2"); mysql_close($conn); header('location:admin'); } }
/** * 创建连接 */ function db($name = 'default') { if (PRODUCTION == false) { $config = $GLOBALS['config']['db']['test']; } else { $config = $GLOBALS['config']['db'][$name]; } $host = $config['host']; $port = $config['port']; $user = $config['user']; $password = $config['password']; $db_name = $config['db_name']; $db_key = MD5($host . '-' . $port . '-' . $user . '-' . $password . '-' . $db_name); if (!isset($GLOBALS['DB_' . $db_key])) { $con = mysql_connect($host . ':' . $port, $user, $password, true); if ($con && mysql_selectdb($db_name)) { @mysql_query('SET NAMES UTF8'); $GLOBALS['DB_' . $db_key] = $con; } else { throw new Exception("Cannot connect to db"); } } return $GLOBALS['DB_' . $db_key]; }
$xmlcode .= "<content>$content</content>\n"; $xmlcode .= "</node>\n"; //DB쿼리로 받아낸 title과 content값을 xml파일에 출력하기 위한 코드 } $dir = "C:/APM_Setup/htdocs"; //board_searchresult.xml 파일을 저장할 경로 $filename = $dir."/board_searchresult.xml"; file_put_contents($filename, $xmlcode); //xmlcode의 내용을 xml파일로 출력 mysql_close($connect); ?> <? $connect = mysql_connect('localhost', 'root', 'apmsetup'); mysql_selectdb("mydb"); mysql_query("set names utf8"); $qry = "SELECT * FROM board"; $result = mysql_query($qry); $total_record = mysql_num_rows($result); echo "total_record=".$total_record."<p>"; while($row_array = mysql_fetch_array($result)){ echo("$row_array[uid] | $row_array[title] | $row_array[content] | <a href='board_fix.php?uid=$row_array[uid]'>수정</a> <a href='board_delete.php?uid=$row_array[uid]'>삭제</a><br>"); } mysql_close($connect); ?>
<?php define('DB_SERVER', 'oraserv.cs.siena.edu'); define('DB_PORT', '3306'); define('DB_USERNAME', 'perm_alphabit'); define('DB_PASSWORD', 'dour=punish-guild'); define('DB_NAME', 'perm_alphabit'); $dbh = mysql_connect(DB_SERVER . ':' . DB_PORT, DB_USERNAME, DB_PASSWORD); if (!$dbh) { echo "Oops! Something went horribly wrong."; exit; } mysql_selectdb(DB_NAME, $dbh); //session_start();
#!/usr/bin/php <?php $SQL = "select * from settings where name like 'weathermap_%'"; require dirname(__FILE__) . '/../../../include/config.php'; $link = mysql_connect($database_hostname, $database_username, $database_password) or die('Could not connect: ' . mysql_error()); mysql_selectdb($database_default, $link) or die('Could not select database: ' . mysql_error()); $nmaps = 0; $warnings = 0; $result = mysql_query($SQL) or die(mysql_error()); while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { $values[$line['name']] = $line['value']; } $nmaps = $values['weathermap_last_map_count']; $SQL = "select sum(warncount) as c from weathermap_maps where active='on'"; $result = mysql_query($SQL) or die(mysql_error()); $line = mysql_fetch_array($result, MYSQL_ASSOC); $warnings = $line['c']; $duration = $values['weathermap_last_finish_time'] - $values['weathermap_last_start_time']; if ($duration < 0) { $duration = "U"; } print "duration:{$duration} nmaps:{$nmaps} warnings:{$warnings} "; if (isset($values['weathermap_final_memory']) && isset($values['weathermap_initial_memory']) && $values['weathermap_loaded_memory'] && isset($values['weathermap_highwater_memory'])) { print "initmem:" . $values['weathermap_initial_memory'] . " "; print "loadedmem:" . $values['weathermap_loaded_memory'] . " "; print "finalmem:" . $values['weathermap_final_memory'] . " "; print "highmem:" . $values['weathermap_highwater_memory'] . " "; } else { print "initmem:U loadedmem:U finalmem:U highmem:U"; } if (isset($values['weathermap_final_memory'])) {
<?php session_start(); if (!$_SESSION['id']) { header('location:index.php'); } $con = mysql_connect('localhost', 'root', ''); mysql_selectdb("zndb", $con); $sql = "SELECT * FROM posts order by postdate desc"; $result = mysql_query($sql); echo '<center><img src="zinnah_overseas_144.png" alt="Zinnah Admin"></center>'; echo "<br/>"; echo "<center><a href='homer.php'>Go back to home page</a></center>"; while ($row = mysql_fetch_array($result)) { echo $row['postname']; echo "<br/>"; echo $row['postcontent']; echo "<br/>"; echo $row['postdate']; echo "<br/>"; echo "<br/>"; } ?> <html> <style> body { background-image: url("22.jpg"); }