本文整理匯總了PHP中MYSQL_CONNECT函數的典型用法代碼示例。如果您正苦於以下問題:PHP MYSQL_CONNECT函數的具體用法?PHP MYSQL_CONNECT怎麽用?PHP MYSQL_CONNECT使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了MYSQL_CONNECT函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: systemDatabase
function systemDatabase()
{
$dbMainHost = "db153.pair.com";
$dbMainUser = "reinfurt_41";
$dbMainPass = "8KxHaSeD";
$dbMainDbse = "reinfurt_point";
$dbConnect = MYSQL_CONNECT($dbMainHost, $dbMainUser, $dbMainPass);
MYSQL_SELECT_DB($dbMainDbse, $dbConnect);
}
示例2: dbCall
function dbCall($dbName)
{
global $hname;
global $uname;
global $pword;
// make connection to database
MYSQL_CONNECT($hname, $uname, $pword) or die("Unable to connect to database");
@mysql_select_db("{$dbName}") or die("Unable to select database");
}
示例3: Databases
/**
* Connecting To Database;
*
* @param $debug = false;
**/
private function Databases($debug = true)
{
global $config;
$this->db = $config['iSafe']['databases']['db_name'];
$this->db_host = $config['iSafe']['databases']['db_host'];
$this->db_user = $config['iSafe']['databases']['db_user'];
$this->db_pass = $config['iSafe']['databases']['db_pass'];
MYSQL_CONNECT($this->db_host, $this->db_user, $this->db_pass) or die($this->debug(1, __LINE__, __FILE__));
MYSQL_SELECT_DB($this->db) or die($this->debug(2, __LINE__, __FILE__));
}
示例4: __construct
public function __construct($db)
{
$this->name = $db->getName();
// load relation list for table
$this->relation = $db->relation;
// establish connection to db server
$this->dbResource = @MYSQL_CONNECT($db->server, $db->user, $db->password);
if (!$this->dbResource) {
OLIVError::fire('no database connection');
return FALSE;
} else {
// connection established
// select database and set prefix
@MYSQL_SELECT_DB($this->name);
if (array_key_exists('prefix', $db)) {
$this->prefix = $db['prefix'];
}
return $this->dbResource;
}
}
示例5: MYSQL_CONNECT
<?php
$hostname = "localhost";
$username = "user";
$password = "password";
$dbName = "DatabaseName";
MYSQL_CONNECT($hostname, $username, $password) or die("Unable to connect to database.");
MYSQL_SELECT_DB("{$dbName}") or die("Unable to select database");
示例6: define
<?php
$db_server = "localhost";
$db_name = "bs";
$db_user = "bs";
$db_passwort = "bspw";
// when change this, then need to edit schema.sql
define("DB_PREFIX", "bs_");
$db = @MYSQL_CONNECT($db_server, $db_user, $db_passwort) or die("Konnte keine Verbindung zur Datenbank herstellen");
$db_select = @MYSQL_SELECT_DB($db_name);
示例7: Error
$mail->SMTPAuth = true;
// enable SMTP authentication
$mail->SMTPKeepAlive = true;
// SMTP connection will not close after each email sent
$mail->Host = "mail.yourdomain.com";
// sets the SMTP server
$mail->Port = 26;
// set the SMTP port for the GMAIL server
$mail->Username = "yourname@yourdomain";
// SMTP account username
$mail->Password = "yourpassword";
// SMTP account password
$mail->SetFrom('list@mydomain.com', 'List manager');
$mail->AddReplyTo('list@mydomain.com', 'List manager');
$mail->Subject = "PHPMailer Test Subject via smtp, basic with authentication";
@MYSQL_CONNECT("localhost", "root", "password");
@mysql_select_db("my_company");
$query = "SELECT full_name, email, photo FROM employee WHERE id={$id}";
$result = @MYSQL_QUERY($query);
while ($row = mysql_fetch_array($result)) {
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
// optional, comment out and test
$mail->MsgHTML($body);
$mail->AddAddress($row["email"], $row["full_name"]);
$mail->AddStringAttachment($row["photo"], "YourPhoto.jpg");
if (!$mail->Send()) {
echo "Mailer Error (" . str_replace("@", "@", $row["email"]) . ') ' . $mail->ErrorInfo . '<br />';
} else {
echo "Message sent to :" . $row["full_name"] . ' (' . str_replace("@", "@", $row["email"]) . ')<br />';
}
// Clear all addresses and attachments for next loop
示例8: MYSQL_CONNECT
<?php
$dbHostname = "localhost";
$dbUsername = "root";
$dbPassword = "It0mat0";
$dbName = "test";
// Make connection to database
// If no connection made, display error Message
$dblink = MYSQL_CONNECT($dbHostname, $dbUsername, $dbPassword) or die("Error !! Unable to connect to database");
// Select the database name to be used or else print error message if unsuccessful*/
@mysql_select_db($dbName) or die("Unable to select database " . $dbName);
示例9: mysql_num_rows
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Test ModRewrite</title>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
</head>
<body>
<?php
@MYSQL_CONNECT("localhost", "iggmp", "grumblfurz34");
@MYSQL_SELECT_DB("iggmp");
$res = mysql_query("SELECT * FROM lang_railway_summary");
echo mysql_num_rows($res);
while ($entry = mysql_fetch_array($res)) {
$text = utf8_encode($entry['content']);
echo $entry['content'] . "<hr>" . $text . "<hr><hr>";
}
?>
</body>
</html>
示例10: createMarker
function createMarker(point, number)
{
var marker = new GMarker(point);
var html = number;
GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
return marker;
};
<?php
$hostname = "xxxx";
$username = "xxxx";
$password = "xxxx";
$dbName = "xxxx";
$link = MYSQL_CONNECT($hostname, $username, $password) or print "Unable to connect to database<BR>";
mysql_selectdb($dbName, $link) or print "Unable to select database<BR>";
$result = mysql_query("SELECT * FROM fiksgrafitti where id={$id}", $link);
if (!$result) {
echo "no results ";
}
while ($row = mysql_fetch_array($result)) {
echo "var point = new GLatLng(" . $row['lat'] . "," . $row['lon'] . ");\n";
echo "var marker = createMarker(point, '" . addslashes($row['feil']) . "<br>" . addslashes($row['sted']) . "');\n";
echo "map.addOverlay(marker);\n";
echo "\n";
}
mysql_close($link);
?>
//]]>
示例11: pageheader
require 'include/init.inc.php';
require 'include/picmgmt.inc.php';
pageheader($lang_util_php['title']);
if (!GALLERY_ADMIN_MODE) {
die('Access denied');
}
global $albumtbl, $picturetbl, $categorytbl, $usertbl, $lang_util_php;
$albumtbl = $CONFIG['TABLE_PREFIX'] . 'albums';
$picturetbl = $CONFIG['TABLE_PREFIX'] . 'pictures';
$categorytbl = $CONFIG['TABLE_PREFIX'] . 'categories';
$usertbl = $CONFIG['TABLE_PREFIX'] . 'users';
// initialize vars
$startpic = '';
$action = "";
$action = $_POST['action'];
MYSQL_CONNECT($CONFIG['dbserver'], $CONFIG['dbuser'], $CONFIG['dbpass']) or die("can't connect to mysql server");
MYSQL_SELECT_DB($CONFIG['dbname']);
function my_flush()
{
print str_repeat(" ", 4096);
// force a flush
}
function filenametotitle($delete)
{
$albumid = $_POST['albumid'];
$parsemode = $_POST['parsemode'];
global $picturetbl, $lang_util_php;
$query = "SELECT * FROM {$picturetbl} WHERE aid = '{$albumid}'";
$result = MYSQL_QUERY($query);
$num = mysql_numrows($result);
$i = 0;
示例12: MYSQL_CONNECT
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<?php
include 'inc/favicon.inc.php';
?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
<title>Unbenanntes Dokument</title>
<?php
$server = "localhost";
$user = "db854004";
$passwort = "EWbrVxjt";
$datenbank = "db854004";
MYSQL_CONNECT($server, $user, $passwort) or die("Fehler - Datenbankserver nicht erreichbar");
#Verbindung zum Datenbankserver herstellen
MYSQL_SELECT_DB($datenbank) or die("Fehler - Datenbank nicht vorhanden");
#Verbindung zur Datenbank herstellen
$daten = mysql_query("Select * from termine");
#Auswahl - Abfrage (Select) auf die Tabelle Termine (wichtig: Tabelle ist nicht Datenbank)
?>
</head>
<body>
<?php
while ($termine = mysql_fetch_array($daten)) {
# Schleifenbeginn, Ausgabe der Datensätze am Bildschirm
echo $termine[1];
}
示例13: header
<?php
header('Content-Type: text/html; charset=utf-8');
$rootpath = dirname(dirname(__FILE__));
$upload_dir = '/img/';
$targetPath = $rootpath . $upload_dir;
$hostname = "localhost";
$username = "root";
$password = "";
$dbName = "test";
$images_table = "zz_images";
MYSQL_CONNECT($hostname, $username, $password) or die("Не могу создать соединение ");
@mysql_select_db("{$dbName}") or die("Не могу выбрать базу данных ");
mysql_query("SET NAMES 'utf8'");
try {
$file_name = $_FILES['Filedata']['name'];
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetFile = str_replace("//", "/", $targetPath) . $file_name;
$fileParts = pathinfo($_FILES['Filedata']['name']);
$extension = $fileParts['extension'];
move_uploaded_file($tempFile, $targetFile);
$sql = "SELECT max(code) as max_code FROM {$images_table} LIMIT 1";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$new_code = $row['max_code'] + 1;
$filename = pathinfo($file_name, PATHINFO_FILENAME);
$filepath = $upload_dir . $file_name;
$sql = "INSERT INTO {$images_table} (`filename`, `type`, `code`, `filepath`) VALUES ('{$filename}', '4', '{$new_code}', '{$filepath}')";
$result = mysql_query($sql);
if ($result) {
echo "1";
示例14: define
<?php
define('CURSCRIPT', 'forumdisplay');
$dbHostname = "localhost";
$dbUsername = "daijiale";
$dbPassword = "123456";
$dbName = "samples";
$dblink = MYSQL_CONNECT($dbHostname, $dbUsername, $dbPassword) or die("�������ݿ�ʧ��");
mysql_select_db($dbName) or die("Unable to select database " . $dbName);
示例15: MYSQL_CONNECT
/**
* Include HTML parsing functionality.
* We depend on the presence of the XML_HTMLSax PEAR package for PHP ({@link http://pear.php.net/package/XML_HTMLSax}).
* You can probably install this like this:
*
* pear install XML_HTMLSax
*
*/
require_once 'XML/XML_HTMLSax.php';
/**
* Include RSS feed creation functionality.
* We depend on the presence of FeedCreator.class.php for PHP ({@link http://www.bitfolge.de/rsscreator-en.html}).
*/
require_once "feedcreator.class.php";
// Connect to the MySQL server
MYSQL_CONNECT($db_host, $db_user, $db_pw);
MYSQL_SELECT_DB($db) or die("Unable to select database");
//Select previously indexed URLs from the cache table, and put them into an array $oneurl
$query = "select url from {$db_table}";
$result = MYSQL_QUERY($query);
$howmanyrecords = MYSQL_NUM_ROWS($result);
$currentrecord = 0;
while ($currentrecord < $howmanyrecords) {
$url = trim(MYSQL_RESULT($result, $currentrecord, "url"));
$oneurl[$url] = 1;
$currentrecord++;
}
date_default_timezone_set('America/Halifax');
/**
* Handlers for HTML parsing.
*/