本文整理汇总了PHP中my_error函数的典型用法代码示例。如果您正苦于以下问题:PHP my_error函数的具体用法?PHP my_error怎么用?PHP my_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了my_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pwg_query
function pwg_query($query)
{
global $conf, $page, $debug, $t2;
$start = microtime(true);
$result = mysql_query($query) or my_error($query, $conf['die_on_sql_error']);
$time = microtime(true) - $start;
if (!isset($page['count_queries'])) {
$page['count_queries'] = 0;
$page['queries_time'] = 0;
}
$page['count_queries']++;
$page['queries_time'] += $time;
if ($conf['show_queries']) {
$output = '';
$output .= '<pre>[' . $page['count_queries'] . '] ';
$output .= "\n" . $query;
$output .= "\n" . '(this query time : ';
$output .= '<b>' . number_format($time, 3, '.', ' ') . ' s)</b>';
$output .= "\n" . '(total SQL time : ';
$output .= number_format($page['queries_time'], 3, '.', ' ') . ' s)';
$output .= "\n" . '(total time : ';
$output .= number_format($time + $start - $t2, 3, '.', ' ') . ' s)';
if ($result != null and preg_match('/\\s*SELECT\\s+/i', $query)) {
$output .= "\n" . '(num rows : ';
$output .= mysql_num_rows($result) . ' )';
} elseif ($result != null and preg_match('/\\s*INSERT|UPDATE|REPLACE|DELETE\\s+/i', $query)) {
$output .= "\n" . '(affected rows : ';
$output .= mysql_affected_rows() . ' )';
}
$output .= "</pre>\n";
$debug .= $output;
}
return $result;
}
示例2: connection_mysql
function connection_mysql($er_connec = 1, $my_bd = '', $bd = 1, $er_bd = 1)
{
global $opac_nb_documents;
global $charset, $SQL_MOTOR_TYPE;
global $charset, $SQL_MOTOR_TYPE, $time_zone, $time_zone_mysql;
if (isset($time_zone) && trim($time_zone)) {
date_default_timezone_set($time_zone);
}
//Pour l'heure PHP
$my_connec = @pmb_mysql_connect(SQL_SERVER, USER_NAME, USER_PASS);
if ($my_connec == 0 && $er_connec == 1) {
die(my_error(0));
}
if ($bd) {
$my_bd == '' ? $my_bd = DATA_BASE : $my_bd;
if (pmb_mysql_select_db($my_bd, $my_connec) == 0 && $er_bd == 1) {
die(my_error(0));
}
}
$opac_nb_documents = @pmb_mysql_result(pmb_mysql_query("select count(*) from notices", $my_connec), 0, 0) * 1;
if ($charset == 'utf-8') {
pmb_mysql_query("set names utf8 ", $my_connec);
} else {
pmb_mysql_query("set names latin1 ", $my_connec);
}
if ($SQL_MOTOR_TYPE) {
pmb_mysql_query("set storage_engine={$SQL_MOTOR_TYPE}", $my_connec);
}
if (isset($time_zone_mysql) && trim($time_zone_mysql)) {
pmb_mysql_query("SET time_zone = {$time_zone_mysql}", $my_connec);
}
//Pour l'heure MySQL
return $my_connec;
}
示例3: my_msg
if (Request::option('com') == 'copyconfig') {
if (Request::option('copyinstid') && Request::option('copyconfigid')) {
$config = ExternConfig::GetInstance(Request::option('copyinstid'), '', Request::option('copyconfigid'));
$config_copy = $config->copy($range_id);
my_msg(sprintf(_("Die Konfiguration wurde als \"%s\" nach Modul \"%s\" kopiert."), htmlReady($config_copy->getConfigName()), htmlReady($GLOBALS['EXTERN_MODULE_TYPES'][$config_copy->getTypeName()]['name'])), 'blank', 1, false);
} else {
Request::set('com','');
}
}
if (Request::option('com') == 'delete') {
$config = ExternConfig::GetInstance($range_id, '', $config_id);
if ($config->deleteConfiguration()) {
my_msg(sprintf(_("Konfiguration <strong>\"%s\"</strong> für Modul <strong>\"%s\"</strong> gelöscht!"), htmlReady($config->getConfigName()), htmlReady($GLOBALS['EXTERN_MODULE_TYPES'][$config->getTypeName()]['name'])), 'blank', 1, false);
} else {
my_error(_("Konfiguration konnte nicht gelöscht werden"));
}
}
echo "<tr><td class=\"blank\" width=\"100%\" valign=\"top\">\n";
if (Request::option('com') == 'delete_sec') {
$config = ExternConfig::GetConfigurationMetaData($range_id, $config_id);
$message = sprintf(_("Wollen Sie die Konfiguration <b>"%s"</b> des Moduls <b>%s</b> wirklich löschen?"), $config["name"], $GLOBALS["EXTERN_MODULE_TYPES"][$config["type"]]["name"]);
$message .= '<br><br>';
$message .= LinkButton::createAccept("JA", URLHelper::getURL('?com=delete&config_id='.$config_id));
$message .= LinkButton::createCancel("NEIN", URLHelper::getURL('?list=TRUE&view=extern_inst'));
my_info($message, "blank", 1);
print_footer();
示例4: parse_window
function parse_window($long_msg, $separator="§", $titel, $add_msg="")
{
if ($titel == "")
$titel= _("Fehler");
if ($add_msg == "")
$add_msg= sprintf(_("%sHier%s geht es zurück zur Startseite."), "<a href=\"index.php\"><em>", "</em></a>") . "<br>";
?>
<table border="0" bgcolor="#000000" align="center" cellspacing="0" cellpadding="2" width="70%">
<tr>
<td class="table_header_bold"><b><? echo $titel?></b></td>
</tr>
<tr>
<td class="blank"> </td>
</tr>
<?php
$msg = explode ($separator,$long_msg);
for ($i=0; $i < count($msg); $i=$i+2) {
switch ($msg[$i]) {
case "error" : my_error($msg[$i+1], "blank", 1); break;
case "info" : my_info($msg[$i+1], "blank", 1); break;
case "msg" : my_msg($msg[$i+1], "blank", 1); break;
}
}
?>
<tr>
<td class="blank"><?= $add_msg ?></td>
</tr>
</table>
<?
}
示例5: mysql_query
$res = mysql_query($sql);
if ($rs=mysql_fetch_array($res)){
$user_id = $rs["id"];
} else {
$sql="INSERT INTO users (nik) VALUES ('$user')";
debug($sql);
mysql_query($sql);
$user_id = mysql_insert_id();
if (!$user_id) my_error();
}
// добавим МП если есть такое исправим
$sql="SELECT * FROM masterplate WHERE tz_id='$tz' AND posintz='$posintz'";
debug($sql);
$res = mysql_query($sql);
if (mysql_num_rows($res) == 0){
$sql="INSERT INTO masterplate (tz_id,posintz,mpdate,user_id) VALUES ('$tz','$posintz','$mpdate','$user_id')";
debug($sql);
mysql_query($sql);
$mp_id = mysql_insert_id();
if (!$mp_id) my_error();
} else {
$sql="UPDATE masterplate SET mpdate='$mpdate', user_id='$user_id' WHERE tz_id='$tz' AND posintz='$posintz'";
debug($sql);
mysql_query($sql);
$rs=mysql_fetch_array($res);
$mp_id = $rs["id"];
}
printf("%08d",$mp_id);
?>
示例6: UAM_dump
/**
* UAM specific database dump (only for MySql !)
* Creates an SQL dump of UAM specific tables and configuration settings
*
* @returns : Boolean to manage appropriate message display
*
*/
function UAM_dump($download)
{
global $conf;
$plugin = PluginInfos(UAM_PATH);
$version = $plugin['version'];
// Initial backup folder creation and file initialisation
// ------------------------------------------------------
if (!is_dir(UAM_PATH . '/include/backup')) {
mkdir(UAM_PATH . '/include/backup');
}
$Backup_File = UAM_PATH . '/include/backup/UAM_dbbackup.sql';
$fp = fopen($Backup_File, 'w');
// Writing plugin version
$insertions = "-- " . $version . " --\n\n";
fwrite($fp, $insertions);
// Saving UAM specific tables
// --------------------------
$ListTables = array(USER_CONFIRM_MAIL_TABLE, USER_LASTVISIT_TABLE);
$j = 0;
while ($j < count($ListTables)) {
$sql = 'SHOW CREATE TABLE ' . $ListTables[$j];
$res = pwg_query($sql);
if ($res) {
$insertions = "-- -------------------------------------------------------\n";
$insertions .= "-- Create " . $ListTables[$j] . " table\n";
$insertions .= "-- ------------------------------------------------------\n\n";
$insertions .= "DROP TABLE IF EXISTS " . $ListTables[$j] . ";\n\n";
$array = pwg_db_fetch_row($res);
$array[1] .= ";\n\n";
$insertions .= $array[1];
$req_table = pwg_query('DESCRIBE ' . $ListTables[$j] . ';') or die(my_error());
$nb_fields = pwg_db_num_rows($req_table);
$req_table2 = pwg_query('SELECT * FROM ' . $ListTables[$j]) or die(my_error());
while ($line = pwg_db_fetch_row($req_table2)) {
$insertions .= 'INSERT INTO ' . $ListTables[$j] . ' VALUES (';
for ($i = 0; $i < $nb_fields; $i++) {
$insertions .= '\'' . pwg_db_real_escape_string($line[$i]) . '\', ';
}
$insertions = substr($insertions, 0, -2);
$insertions .= ");\n";
}
$insertions .= "\n\n";
}
fwrite($fp, $insertions);
$j++;
}
// Saving UAM configuration
// ------------------------
$insertions = "-- -------------------------------------------------------\n";
$insertions .= "-- Insert UAM configuration in " . CONFIG_TABLE . "\n";
$insertions .= "-- ------------------------------------------------------\n\n";
fwrite($fp, $insertions);
$pattern = "UserAdvManager%";
$req_table = pwg_query('SELECT * FROM ' . CONFIG_TABLE . ' WHERE param LIKE "' . $pattern . '";') or die(my_error());
$nb_fields = pwg_db_num_rows($req_table);
$nb_fields = $nb_fields - 1;
// Fix the number of fields because pwg_db_num_rows() returns a bad number
while ($line = pwg_db_fetch_row($req_table)) {
$insertions = 'INSERT INTO ' . CONFIG_TABLE . ' VALUES (';
for ($i = 0; $i < $nb_fields; $i++) {
$insertions .= '\'' . pwg_db_real_escape_string($line[$i]) . '\', ';
}
$insertions = substr($insertions, 0, -2);
$insertions .= ");\n";
fwrite($fp, $insertions);
}
fclose($fp);
// Download generated dump file
// ----------------------------
if ($download == 'true') {
if (@filesize($Backup_File)) {
$http_headers = array('Content-Length: ' . @filesize($Backup_File), 'Content-Type: text/x-sql', 'Content-Disposition: attachment; filename="UAM_dbbackup.sql";', 'Content-Transfer-Encoding: binary');
foreach ($http_headers as $header) {
header($header);
}
@readfile($Backup_File);
exit;
}
}
return true;
}
示例7: customers
echo "Каталог на диске К (для сверловок): <input type=text name=kdir size=50 value='".$rs["kdir"]."'><br>";
echo "<input type=button value='Сохранить' onclick=\"editrecord('customers',$('#editform').serialize())\"><input type=button value='Отмена' onclick='closeedit()'>";
} else {
// сохрнение
if ($edit) {
// редактирование
$sql = "UPDATE customers SET customer='$customer', fullname='$fullname', kdir='$kdir' WHERE id='$edit'";
mylog('customers',$edit,'UPDATE');
mylog($sql);
} else {
// добавление
$sql = "INSERT INTO customers (customer,fullname,kdir) VALUES ('$customer','$fullname','$kdir')";
mylog($sql);
}
if (!mysql_query($sql)) {
my_error("Не удалось внести изменения в таблицу customers!!!");
} else {
echo "<script>updatetable('$tid','customers','');closeedit();</script>";
}
}
} elseif (isset($delete)) {
// удаление
$sql = "DELETE FROM customers WHERE id='$delete'";
mylog('customers',$delete);
mysql_query($sql);
// удаление связей
// удалить и платы заказчика
$sql = "SELECT * FROM plates WHERE customer_id='$delete'";
$res = mysql_query($sql);
while ($rs=mysql_fetch_array($res)) {
$sql = "DELETE FROM plates WHERE id='".$rs["id"]."'";
示例8: VALUES
$sql="INSERT INTO sk_".$sklad."_dvizh_arc (type,numd,numdf,docyr,spr_id,quant,ddate,post_id,comment_id,price) VALUES ('0','$numd','$numdf','$docyr','$id','$ost','$ddate','$post_id','$comment_id','0')" ;
mylog1($sql);
print $sql."<br>";
if(!mysql_query($sql))
my_error();
// создадим первое движение года
// коментарий
$sql="SELECT id FROM coments WHERE comment='Остаток на 31.12.$docyr'";
print $sql."<br>";
$res1 = mysql_query($sql);
if ($rs1=mysql_fetch_array($res1)){
$comment_id = $rs1["id"];
} else {
$sql="INSERT INTO coments (comment) VALUES ('Остаток на 31.12.$docyr')";
mylog1($sql);
mysql_query($sql);
$comment_id = mysql_insert_id();
if (!$comment_id) my_error();
}
$docyr = date("Y");
$ddate = date("Y-m-d",mktime(0,0,0,1,1,$docyr));
$sql="INSERT INTO sk_".$sklad."_dvizh (type,numd,numdf,docyr,spr_id,quant,ddate,post_id,comment_id,price) VALUES ('1','$numd','$numdf','$docyr','$id','$ost','$ddate','$post_id','$comment_id','0')" ;
mylog1($sql);
print $sql."<br>";
if(!mysql_query($sql))
my_error();
}
print "<script>window.location='http://".$_SERVER['HTTP_HOST'].$GLOBALS["PHP_SELF"]."';</script>";
?>
示例9: mysql_insert_id
$spr_id = mysql_insert_id();
if(!$spr_id)
my_error();
$sql="INSERT INTO sk_".$sklad."_ost (spr_id,ost) VALUES ($spr_id,'0')" ;
} else {
$sql="UPDATE sk_".$sklad."_spr SET nazv='$nazv', edizm='$edizm', krost='$krost' WHERE id='$edit'";
}
mylog1($sql);
if(!mysql_query($sql))
my_error();
print "<script>window.location='http://".$_SERVER['HTTP_HOST'].$GLOBALS["PHP_SELF"]."';</script>";
} else {
if($edit!=0) {
$sql="SELECT * FROM sk_".$sklad."_spr WHERE id='".$edit."'";
$res=mysql_query($sql);
if (!$rs=mysql_fetch_array($res)) my_error();
}
print "<form action='' method=post>Наименование:<input size=50 type=text name=nazv value='".$rs["nazv"]."'><br>Единица измерения:<input type=text name=edizm value='".$rs["edizm"]."'><br>Критический остаток:<input type=text name=krost value='".$rs["krost"]."'><br><input type=submit name=submit value='Сохранить'><input type=button onclick='history.back()' value='Отмена'><input type=hidden name=edit value='$edit'></form>";
}
} else
{
// вывести таблицу
if(isset($view) & $view=='all')
print "<center><a href='http://".$_SERVER['HTTP_HOST'].$GLOBALS["PHP_SELF"]."'>Первые 20</a>";
else
print "<center><a href='?view=all'>Все</a>";
print "<form method=post action=''><input type=hidden name=action value='find'>Поиск:<input type=text name='ssrt' size=10><input type=hidden name=tz></form>";
print "<input type=button onclick=\"window.location='http://".$_SERVER['HTTP_HOST'].$GLOBALS["PHP_SELF"]."?edit=0'\" value='Добавить новый'><br>";
print "<form name=treb target=_blank method=post action='../treball.php'>";
include "trebformall.php";
print "<table width=100% border=1>";
示例10: mysql_insert_id
debug($sql);
mysql_query($sql);
$user_id = mysql_insert_id();
if (!$user_id) my_error();
}
// добавим
if (!isset($ts))
$ts='NOW()';
else
$ts="'$ts'";
$sql="INSERT INTO phototemplates (ts,user_id,filenames) VALUES ($ts,'$user_id','$filenames')";
debug($sql);
mysql_query($sql);
$filenames_id = mysql_insert_id();
if (!$filenames_id) my_error();
}
else
{
// вывести таблицу
print "<center><a href='?action=".($action=='all'?"'>Последние 20":"all'>Все")."</a></center><br><form method=post action=''><input type=hidden name=action value='find'>Поиск:<input type=text name='ssrt' size=10></form>";
print "<table class='listtable' cellspacing=0 cellpadding=0>";
print "<thead>";
print "<tr>";
print "<td>Дата - время</td><td>Кто добавил</td><td>Количество шаблонов и каталог</td>";
print "</tr>";
print "<tbody>";
$sql="SELECT *,unix_timestamp(ts) AS uts FROM phototemplates JOIN users ON phototemplates.user_id=users.id ".($action=='find'?"WHERE filenames LIKE '%$ssrt%'":"")."ORDER BY ts DESC ".($action=='all'?"":"LIMIT 20");
debug($sql);
$res = mysql_query($sql);
示例11: conductors
echo "<br><input type=button value='Сохранить' onclick=\"editrecord('conductors',$('#editform').serialize())\"><input type=button value='Отмена' onclick='closeedit()'><input type=button onclick=\"alert($('#editform').serialize())\">";
echo "</form>";
}
else
{
// сохранение
if ($edit!=0) {
$sql = "UPDATE conductors SET board_id='$plate_id', pib='$pib', side='$side', lays='$lays', user_id='$userid', ts=NOW() WHERE id='$edit'";
} else {
$sql = "INSERT INTO conductors (board_id,pib,side,lays,user_id,ts) VALUES('$plate_id','$pib','$side','$lays','$userid',NOW())";
}
if (!mysql_query($sql)) {
my_error("Не удалось изменить Кондуктор");
} else {
echo "<script>updatetable('$tid','conductors','');closeedit();</script>";
}
}
}
elseif (isset($print)) {
}
else
{
// вывести таблицу
// sql
$sql="SELECT *,conductors.id FROM conductors JOIN (plates,customers) ON (conductors.board_id=plates.id AND plates.customer_id=customers.id ) WHERE ready='0' ".(isset($find)?"AND (plates.plate LIKE '%$find%')":"").($order!=''?" ORDER BY ".$order." ":" ORDER BY conductors.id DESC ").(isset($all)?"":"LIMIT 20");
示例12: my_info
<?
if (!empty($new_account_cms))
{
$output = ELearningUtils::getNewAccountForm($new_account_cms);
}
if ($messages["info"] != "")
{
echo "<table>";
my_info($messages["info"]);
echo "</table>";
}
if ($messages["error"] != "")
{
echo "<table>";
my_error($messages["error"]);
echo "</table>";
}
?>
<table cellpadding="10" cellspacing="01" border="0" width="100%"><tr><td>
<?
echo $output;
if ($new_account_cms == "")
{
echo _("Hier können Sie nach Lernmodulen suchen.");
?>
<br><br>
<?
示例13: my_error
* @author Arne Schroeder <schroeder@data.quest.de>
* @access public
* @modulegroup export_modules
* @module export_view
* @package Export
*/
if (($o_mode != "direct") AND ($o_mode != "passthrough"))
{
// Start of Output
PageLayout::setTitle($export_pagename);
Navigation::activateItem('/tools/export');
?>
<?
if (isset($export_error))
my_error($export_error);
if (isset($export_msg))
my_msg($export_msg);
if (isset($export_info))
my_info($export_info);
?>
<?
echo $export_pagecontent;
if (isset($xml_printlink))
{
?>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<?
printhead ("99%", FALSE, "", "open", true, ' ' . $xml_printimage, $xml_printlink, $xml_printdesc);
示例14: logout
function logout() {
global $dbname;
if (isset($dbname) && $dbname!="zaompp" && !mysql_select_db("zaompp") ) my_error("Не удалось выбрать таблицу zaompp");
$sql="DELETE FROM session WHERE session='".$sessionid."'";
mysql_query($sql);
if (isset($dbname) && $dbname!="zaompp" && !mysql_select_db($dbname) ) my_error("Не удалось выбрать таблицу $dbname");
setcookie("sessionid","",time() - 3600,'/');
//echo $sql;
//header('Location: http://'.$_SERVER['HTTP_HOST'].'');
echo "<script>window.location='http://".$_SERVER['HTTP_HOST']."'</script>";
}
示例15: export_inst
/**
* Exports a Stud.IP-institute.
*
* This function gets the data of an institute and writes it into $data_object.
* It calls one of the functions export_sem, export_pers or export_teilis and then output_data.
*
* @access public
* @param string $inst_id Stud.IP-inst_id for export
* @param string $ex_sem_id allows to choose if only a specific lecture is to be exported
*/
function export_inst($inst_id, $ex_sem_id = "all")
{
global $ex_type, $o_mode, $xml_file, $xml_names_inst, $xml_groupnames_inst, $INST_TYPE;
$query = "SELECT * FROM Institute WHERE Institut_id = ?";
$statement = DBManager::get()->prepare($query);
$statement->execute(array($inst_id));
$institute = $statement->fetch(PDO::FETCH_ASSOC);
$data_object .= xml_open_tag($xml_groupnames_inst["object"], $institute['Institut_id']);
while (list($key, $val) = each($xml_names_inst)) {
if ($val == '') {
$val = $key;
}
if ($key == 'type' && $INST_TYPE[$institute[$key]]['name'] != '') {
$data_object .= xml_tag($val, $INST_TYPE[$institute[$key]]['name']);
} elseif ($institute[$key] != '') {
$data_object .= xml_tag($val, $institute[$key]);
}
}
reset($xml_names_inst);
$query = "SELECT Name, Institut_id, type\n FROM Institute\n WHERE Institut_id = ? AND fakultaets_id = Institut_id";
$statement = DBManager::get()->prepare($query);
$statement->execute(array($institute['fakultaets_id']));
$faculty = $statement->fetch(PDO::FETCH_ASSOC);
if ($faculty['Name'] != '') {
$data_object .= xml_tag($xml_groupnames_inst["childobject"], $faculty['Name'], array('key' => $faculty['Institut_id']));
}
// freie Datenfelder ausgeben
$data_object .= export_datafields($inst_id, $xml_groupnames_inst["childgroup2"], $xml_groupnames_inst["childobject2"], 'inst', $faculty['type']);
output_data($data_object, $o_mode);
$data_object = "";
switch ($ex_type) {
case "veranstaltung":
export_sem($inst_id, $ex_sem_id);
break;
case "person":
if ($ex_sem_id == "all") {
export_pers($inst_id);
} elseif ($GLOBALS['perm']->have_studip_perm('tutor', $ex_sem_id)) {
export_teilis($inst_id, $ex_sem_id);
} else {
$data_object .= xml_tag("message", _("KEINE BERECHTIGUNG!"));
}
break;
default:
echo "</td></tr>";
my_error(_("Der gewählte Exportmodus wird nicht unterstützt."));
echo "</table></td></tr></table>";
die;
}
$data_object .= xml_close_tag($xml_groupnames_inst["object"]);
output_data($data_object, $o_mode);
$data_object = "";
}