本文整理汇总了PHP中mysql::error方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql::error方法的具体用法?PHP mysql::error怎么用?PHP mysql::error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql
的用法示例。
在下文中一共展示了mysql::error方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query_mult_assoc
function query_mult_assoc($query)
{
global $log_all, $log_error;
if ($result = mysql_query(quote_smart($query))) {
while ($row = mysql_fetch_assoc($result)) {
$array[] = $row;
}
if ($log_all == 1) {
logSQL($query);
}
return isset($array) ? $array : '';
}
if ($log_error == 1) {
logSQL($query . " - Error: " . mysql_error());
} else {
mysql::error($query . " - " . mysql_error());
}
}
示例2: query
public function query($statement)
{
$mysql = new mysql($this->db_handle);
$statement = $this->replaceTablePrefix($statement);
$mysql->query($statement);
$this->set_error($mysql->error());
if ($mysql->error()) {
return null;
} else {
return $mysql;
}
}
示例3: step5
function step5($data)
{
if ($_POST['meta_name'] == "" || $_POST['alli_tag'] == "" || $_POST['alli_name'] == "" || $_POST['user_name'] == "" || $_POST['user_password'] == "" || $_POST['user_coords1'] == "" || $_POST['user_coords2'] == "") {
return "Du musst alle Felder ausfüllen.";
}
echo "<div style=\"border:1px #000000 solid;width:400px;padding:3px;\"><b>Schritt 5: Abschluß der Installation</b><div style=\"text-align:left\">";
$t =& $_SESSION['install']['mysql'];
$file = @fopen("../accdata.php", "w");
if (!$file) {
echo "<div style=\"color:#800000\">Die Datei accdata.php konnte nicht zum schreiben öffnen. Trage die Mysqldaten bitte nachträglich ein.</div>";
} else {
fwrite($file, "<?php\n // Account Daten\n \$db_info['host'] = '" . $t['host'] . "';\n \$db_info['user'] = '" . $t['username'] . "';\n \$db_info['password'] = '" . $t['password'] . "';\n \$db_info['dbname'] = '" . $t['database'] . "';\n \$pfadzumtick = '" . $_SESSION['install']['tic_adress'] . "'; // Der Schrägstrich am Ende ist wichtig!\n\n \$tic_status = array('" . implode("', '", $GLOBALS['status']) . "');\n \$tic_version = array(" . implode(", ", $GLOBALS['version']) . ");\n ?>");
fclose($file);
@chmod("../accdata.php", 0777);
}
$mysql = new mysql(array('host' => $t['host'], 'user' => $t['username'], 'password' => $t['password'], 'dbname' => $t['database']));
unset($t);
if (isset($_SESSION['install']['tables'])) {
include "sql.php";
foreach ($_SESSION['install']['tables'] as $table) {
$mysql->multiquery($sqlquery[$table]) or die($mysql->error(__FILE__, __LINE__));
}
}
$mysql->insert("gn4meta", "name, sysmsg", "'" . $_POST['meta_name'] . "', 'Wenn dieser Text zu lesen ist dann ist leuft der TIC diese Nachricht kann unter Managment geändert werden.'") or die($mysql->error(__FILE__, __LINE__));
$ticid = $mysql->insert_id();
$mysql->insert("gn4vars", "name, value, ticid", "'lastscanclean', '" . date("H:n d.m.Y.") . "', '" . $ticid . "'") or die($mysql->error(__FILE__, __LINE__));
$mysql->insert("gn4vars", "name, value, ticid", "'forumpriority', '0', '" . $ticid . "'") or die($mysql->error(__FILE__, __LINE__));
$mysql->insert("gn4vars", "name, value, ticid", "'lasttick', '" . date("H:n:s") . "', '" . $ticid . "'") or die($mysql->error(__FILE__, __LINE__));
$mysql->insert("gn4vars", "name, value, ticid", "'style', '../gnstyle', '" . $ticid . "'") or die($mysql->error(__FILE__, __LINE__));
$mysql->insert("gn4vars", "name, value, ticid", "'attplaner', 'aktiv', '" . $ticid . "'") or die($mysql->error(__FILE__, __LINE__));
$mysql->insert("gn4vars", "name, value, ticid", "'botpw', '', '" . $ticid . "'") or die($mysql->error(__FILE__, __LINE__));
$mysql->insert("gn4vars", "name, value, ticid", "'tickdauer', '15', '" . $ticid . "'") or die(mysql_error(__FILE__, __LINE__));
$mysql->insert("gn4allianzen", "ticid, name , tag", "'" . $ticid . "', '" . $_POST['alli_name'] . "', '" . $_POST['alli_tag'] . "'") or die($mysql->error(__FILE__, __LINE__));
$alli_id = $mysql->insert_id();
$mysql->insert("gn4accounts", "ticid, name, passwort, galaxie, planet, rang, allianz", "'" . $ticid . "', '" . $_POST['user_name'] . "', '" . md5($_POST['user_password']) . "', '" . $_POST['user_coords1'] . "', '" . $_POST['user_coords2'] . "', '5', '" . $alli_id . "'") or die($mysql->error(__FILE__, __LINE__));
echo "Die Installation wurde erfolgreich abgeschlossen.<br />Bitte lösche den Ordner installer vom Server.<br />Danach kannst du dich <a href=\"../index.php\">hier</a> mit deinen Accountdaten einloggen.</div>";
return "";
}
示例4: mysql
# Tentative de connexion à la base de données
$con_id = mysqli_connect(${$environement . '_host'}, ${$environement . '_user'}, ${$environement . '_password'});
if (!$con_id) {
$errors->set('MySQL: ' . mysqli_connect_errno() . ' ' . mysqli_connect_error());
} else {
mysqli_query($con_id, "CREATE DATABASE IF NOT EXISTS " . ${$environement . '_database'});
$db = mysqli_select_db($con_id, ${$environement . '_database'});
if (!$db) {
$errors->set('MySQL: ' . mysqli_errno($con_id) . ' ' . mysqli_error($con_id));
}
mysqli_close($con_id);
}
if ($errors->isEmpty()) {
$db = new mysql();
$db->init(${$environement . '_user'}, ${$environement . '_password'}, ${$environement . '_host'}, ${$environement . '_database'});
if ($db->error()) {
$errors->set($db->error());
} else {
# Création du fichier de configuration
$configfile = OKT_CONFIG_PATH . '/connexion.php';
$config = implode('', (array) file($configfile . '.in'));
$config = str_replace('%%DB_PROD_HOST%%', $prod_host, $config);
$config = str_replace('%%DB_PROD_USER%%', $prod_user, $config);
$config = str_replace('%%DB_PROD_PASS%%', $prod_password, $config);
$config = str_replace('%%DB_PROD_BASE%%', $prod_database, $config);
$config = str_replace('%%DB_PROD_PREFIX%%', $prod_prefix, $config);
$config = str_replace('%%DB_DEV_HOST%%', $dev_host, $config);
$config = str_replace('%%DB_DEV_USER%%', $dev_user, $config);
$config = str_replace('%%DB_DEV_PASS%%', $dev_password, $config);
$config = str_replace('%%DB_DEV_BASE%%', $dev_database, $config);
$config = str_replace('%%DB_DEV_PREFIX%%', $dev_prefix, $config);
示例5: query
function query($statement)
{
$mysql = new mysql($this->db_handle);
$mysql->query($statement);
$this->set_error($mysql->error());
if ($mysql->error()) {
return null;
} else {
return $mysql;
}
}