本文整理汇总了PHP中DBManager::display_error方法的典型用法代码示例。如果您正苦于以下问题:PHP DBManager::display_error方法的具体用法?PHP DBManager::display_error怎么用?PHP DBManager::display_error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager
的用法示例。
在下文中一共展示了DBManager::display_error方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addFeedbackFrom
function addFeedbackFrom($user, $value)
{
require_once "query.php";
$db = new DBManager();
if (!$db->connect_errno()) {
define_tables();
defineFeedbackColumns();
$table = Query::getDBSchema()->getTable(TABLE_FEEDBACK);
$db->execute($s = Query::generateInsertStm($table, array(FEEDBACK_CREATOR => $user->getID(), FEEDBACK_SUBJECT => $this->getID(), FEEDBACK_VALUE => $value ? 1 : 0)), $table->getName(), $this);
if ($db->affected_rows() != 1) {
$db->display_error("User::addFeedbackFrom()");
}
//Genera un errore ma ritorna comunque $this
} else {
$db->display_connect_error("User::addFeedbackFrom()");
}
return $this->loadFeedback();
}
示例2: addLogEntry
/**
* Aggiunge una entry al Log.
*
* @param $user: l'utente che ha fatto l'azione.
* @param $action: l'azione eseguita dall'utente, fa parte delle chiavi di LogManager::$actions.
* @param $object: l'oggetto che subisce l'azione (prima che venga eseguita).
*
* @return: l'id della entry inserita, false se non c'è riuscito.
*/
static function addLogEntry($user, $action, $tablename, $object)
{
if ($object == LOGMANAGER) {
return;
}
//echo $user. $action. $tablename . serialize(is_object($object)); //DEBUG
if (!isset($user) || !is_numeric($user) || !isset($action) || $action != self::$DELETE && $action != self::$INSERT && $action != self::$UPDATE || !isset($object) || is_null($object) || !is_object($object)) {
return false;
}
$db = new DBManager();
if (!$db->connect_errno()) {
define_tables();
defineLogColumns();
$table = Query::getDBSchema()->getTable(TABLE_LOG);
//echo "<br />" . $tablename; //DEBUG
$sha1ed = sha1(serialize($object));
$id = sha1($sha1ed . $action . $table . $user . time());
$data = array(LOG_ID => $id, LOG_ACTION => $action, LOG_TABLE => $tablename, LOG_SUBJECT => $user, LOG_OBJECT => $sha1ed);
$s = Query::generateInsertStm($table, $data);
//echo "<br />" . $s; //DEBUG
$rs = mysql_query($s, $db->dblink);
//devo fare così è non usare DBManager::execute() perché non avrei affected_rows.
if (mysql_affected_rows($db->dblink)) {
return $id;
} else {
$db->display_error("LogManager::addLogEntry()");
}
} else {
$db->display_connect_error("LogManager::addLogEntry()");
}
return false;
}
示例3: loadFeedback
function loadFeedback()
{
require_once "query.php";
$db = new DBManager();
if (!$db->connect_errno()) {
define_tables();
defineFeedbackColumns();
$table = Query::getDBSchema()->getTable(TABLE_FEEDBACK);
$db->execute($s = Query::generateSelectStm(array($table), array(), array(new WhereConstraint($table->getColumn(FEEDBACK_SUBJECT), Operator::EQUAL, $this->getID())), array()));
if ($db->num_rows() > 0) {
require_once "strings/strings.php";
$fb = FEEDBACK_INITIAL_VALUE;
while ($row = $db->fetch_result()) {
$fb += intval($row[FEEDBACK_VALUE]) > 0 ? 1 : -1;
//se sul DB è 0 allora è -1 se è positivo allora +1;
}
return $this->setFeedback($fb);
} else {
if ($db->errno()) {
$db->display_error("User::loadFeedback()");
}
}
} else {
$db->display_connect_error("User::loadFeedback()");
}
return $this->setFeedback(FEEDBACK_INITIAL_VALUE);
}
示例4: loadMailsFromUser
static function loadMailsFromUser($user)
{
require_once "query.php";
$db = new DBManager();
if (!$db->connect_errno()) {
define_tables();
defineMailColumns();
$table = Query::getDBSchema()->getTable(TABLE_MAIL);
$db->execute($s = Query::generateSelectStm(array($table), array(), array(new WhereConstraint($table->getColumn(MAIL_FROM), Operator::EQUAL, $user)), array()), $table->getName(), $this);
//echo "<p>" . $s . "</p>"; //DEBUG
//echo "<p>" . $db->num_rows() . "</p>"; //DEBUG
if ($db->num_rows() == 1) {
// echo serialize(mysql_fetch_assoc($rs)); //DEBUG
$mails = array();
while ($row = $db->fetch_result()) {
$data = array("text" => $row[MAIL_TEXT], "subject" => $row[MAIL_SUBJECT], "from" => intval($row[MAIL_FROM]), "to" => $row[MAIL_TO], "repliesTo" => $row[MAIL_REPLIES_TO]);
$m = new Mail($data);
$m->setID(intval($row[MAIL_ID]))->setCreationDate(date_timestamp_get(date_create_from_format("Y-m-d G:i:s", $row[MAIL_CREATION_DATE])));
$mails[] = $m;
}
//echo "<p>" .$m ."</p>";
return $mails;
} else {
$db->display_error("Mail::loadMailsFromUser()");
}
} else {
$db->display_connect_error("Mail::loadMailsFromUser()");
}
return false;
}
示例5: loadReports
/**
* Carica in this i report recuperati dal database per questo post (deve avere un ID!).
*/
function loadReports()
{
require_once "query.php";
$db = new DBManager();
if (!$db->connect_errno()) {
define_tables();
defineReportColumns();
$table = Query::getDBSchema()->getTable(TABLE_REPORT);
$rs = $db->execute($s = Query::generateSelectStm(array($table), array(), array(new WhereConstraint($table->getColumn(REPORT_POST), Operator::EQUAL, $this->getID())), array()), $table->getName(), $this);
if ($rs !== false) {
$reports = array();
while ($row = $db->fetch_result()) {
require_once "common.php";
$report = new Report(intval($row[REPORT_USER]), intval($row[REPORT_POST]), $row[REPORT_TEXT]);
$report->setID($row[REPORT_ID]);
$reports[] = $report;
}
$this->setReports($reports);
} else {
if ($db->errno()) {
$db->display_error("Post::loadReports()");
}
}
} else {
$db->display_connect_error("Post::loadReports()");
}
return $this;
}
示例6: loadWinners
function loadWinners()
{
require_once "query.php";
$db = new DBManager();
if (!$db->connect_errno()) {
$table = Query::getDBSchema()->getTable(TABLE_CONTEST_SUBSCRIBER);
$rs = $db->execute($s = Query::generateSelectStm(array($table), array(), array(new WhereConstraint($table->getColumn(CONTEST_SUBSCRIBER_CONTEST), Operator::EQUAL, $this->getID()), new WhereConstraint($table->getColumn(CONTEST_SUBSCRIBER_PLACEMENT), Operator::GREATER, 0)), array()), $table->getName(), $this);
//echo "<p>" . $s . "</p>"; //DEBUG;
//echo "<p>" . mysql_num_rows($rs) . "</p>"; //DEBUG;
if ($db->num_rows() > 0) {
$win = array();
while ($row = $db->fetch_result()) {
$win[$row[CONTEST_SUBSCRIBER_PLACEMENT]] = $row[CONTEST_SUBSCRIBER_POST];
// Con in cs_winner il numero di posizione
//$win[] = $row[CONTEST_SUBSCRIBER_POST]; // Con in cs_winner true o false
}
$this->setWinners($win);
} else {
if ($db->errno()) {
$db->display_error("Contest::loadWinners()");
}
}
} else {
$db->display_connect_error("Contest::loadWinners()");
}
return $this;
}
示例7: DBManager
// $mysqli->close();
$db = new DBManager();
require_once "db.php";
$queries = explode("\n\n", $s);
for ($i = 0; $i < count($queries); $i++) {
$db->execute($queries[$i], null, LOGMANAGER);
if ($db->result) {
$ss = explode("`", $queries[$i]);
echo "<p>TABLE " . $ss[1] . " INSTALLED</p>";
} else {
//DEBUG
$s = str_replace(",", ",<br />", $queries[$i]);
$s = str_replace(") ENGINE", ")<br />ENGINE", $s);
echo $s;
//DEBUG
echo $db->display_error("Install.php");
}
}
$db->execute("INSERT INTO `Role` VALUES('admin')", "Role", null);
$ra = $db->affected_rows();
$db->execute("INSERT INTO `Role` VALUES('user')", "Role", null);
$ra += $db->affected_rows();
if ($ra == 2) {
echo "<p>INSERTED ROLES</p>";
} else {
$db->display_error("Install.php");
}
// DEBUG
$db->execute("INSERT INTO `User` VALUES(1, 'ioesisto', 'no-reply@ioesisto.com', sha1('ciccia'), 'Io', 'Esisto', 'm', NULL, NULL, NULL, NULL, NULL, NULL, 'admin', '2010-08-27 11:49:28', 1, 1)", "User", null);
if ($db->affected_rows() == 1) {
echo "<p>INSERTED FAKE USER</p>";
示例8: addFollower
function addFollower($user)
{
require_once "query.php";
$db = new DBManager();
if (!$db->connect_errno()) {
define_tables();
defineFollowColumns();
$table = Query::getDBSchema()->getTable(TABLE_FOLLOW);
$db->execute($s = Query::generateInsertStm($table, array(FOLLOW_FOLLOWER => $user->getID(), FOLLOW_SUBJECT => $this->getID())), $table->getName(), $this);
if ($db->affected_rows() != 1) {
$db->display_error("User::addFollower()");
}
//Genera un errore ma ritorna comunque $this
} else {
$db->display_connect_error("User::addFollower()");
}
return $this->loadFollowers();
}
示例9: delete
function delete()
{
require_once "query.php";
$db = new DBManager();
if (!$db->connect_errno()) {
define_tables();
defineVoteColumns();
$table = Query::getDBSchema()->getTable(TABLE_VOTE);
$rs = $db->execute($s = Query::generateDeleteStm($table, array(new WhereConstraint($table->getColumn(VOTE_AUTHOR), Operator::EQUAL, $this->getAuthor()), new WhereConstraint($table->getColumn(VOTE_POST), Operator::EQUAL, $this->getPost()))), $table->getName(), $this);
//echo "<br />" . $s; //DEBUG
if ($db->affected_rows() == 1) {
return $this;
} else {
$db->display_error("Vote::delete()");
}
} else {
$db->display_connect_error("Vote::delete()");
}
return false;
}