本文整理匯總了PHP中MySQL_Query函數的典型用法代碼示例。如果您正苦於以下問題:PHP MySQL_Query函數的具體用法?PHP MySQL_Query怎麽用?PHP MySQL_Query使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了MySQL_Query函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Query
FUNCTION Query($query) {
$result = MySQL_Query($query, $this->DB) OR Die(VA_Message("MySQL Error #".MySQL_ErrNo()." :\n".MySQL_Error()."\n".$query, "bug"));
$this->affected_rows = MySQL_Affected_Rows($this->DB);
$this->mysql_queries++;
RETURN NEW result($result);
}
示例2: prava
function prava($modul,$subint='*',$osoba='*') {
// jako default subintu dat parametr subint z URL
// jako default osoby dat to definici funkce toho, kdo je prihlasenej
//echo "DEBUG: $subint<br>";
if ($subint!=='*') $subint_sql=" AND subint='$subint'";
if ($osoba==='*') $osoba=13740;
//echo "DEBUG: subint=$subint osoba=$osoba<br>";
$tmp=MySQL_Query("SELECT * FROM prava WHERE modul='$modul' AND (osoba=0 OR osoba='$osoba') $subint_sql ORDER BY uroven DESC LIMIT 1");
if ($zaznam=MySQL_Fetch_Assoc($tmp)) return $zaznam[uroven];
else return 0;
}
示例3: MySQL_Query
?>
</ul>
<!-- end of # -->
<?php
} else {
?>
<em>Symbol nebyl přiřazen žádnému případu.</em><br /><?php
}
// konec seznamu přiřazených případů
// generování seznamu přiřazených hlášení
if ($usrinfo['right_power']) {
$sql_s = "SELECT " . DB_PREFIX . "reports.id AS 'id', " . DB_PREFIX . "reports.label AS 'label' FROM " . DB_PREFIX . "symbol2all, " . DB_PREFIX . "reports WHERE " . DB_PREFIX . "reports.id=" . DB_PREFIX . "symbol2all.idrecord AND " . DB_PREFIX . "symbol2all.idsymbol=" . $rec['id'] . " AND " . DB_PREFIX . "symbol2all.table=4 ORDER BY " . DB_PREFIX . "reports.label ASC";
} else {
$sql_s = "SELECT " . DB_PREFIX . "reports.id AS 'id', " . DB_PREFIX . "reports.label AS 'label' FROM " . DB_PREFIX . "symbol2all, " . DB_PREFIX . "reports WHERE " . DB_PREFIX . "reports.id=" . DB_PREFIX . "symbol2all.idrecord AND " . DB_PREFIX . "symbol2all.idsymbol=" . $rec['id'] . " AND " . DB_PREFIX . "symbol2all.table=4 AND " . DB_PREFIX . "reports.secret=0 ORDER BY " . DB_PREFIX . "reports.label ASC";
}
$pers = MySQL_Query($sql_s);
$i = 0;
while ($perc = MySQL_Fetch_Assoc($pers)) {
$i++;
if ($i == 1) {
?>
<strong>Hlášení:</strong>
<ul id=""><?php
}
?>
<li><a href="readactrep.php?rid=<?php
echo $perc['id'];
?>
"><?php
echo $perc['label'];
?>
示例4: MySQL_Free_Result
MySQL_Free_Result($res);
echo date("H:i:s")." nalezeno $count zaznamu<br>\n";
break;
case "kraje":
$res=MySQL_Query("SELECT * FROM kraje");
while ($record=MySQL_Fetch_Assoc($res))
$kraj[$record[oznaceni]]=$record[id];
MySQL_Free_Result($res);
echo date("H:i:s")." načteny kraje<br>\n";
$count=0;
$res=MySQL_Query("SELECT * FROM oddily");
while ($record=MySQL_Fetch_Assoc($res)):
$count++;
$up=$kraj[substr($record[fox_id],0,1)];
MySQL_Query("UPDATE oddily SET kraj=$up WHERE id='$record[id]'");
endwhile;
MySQL_Free_Result($res);
echo date("H:i:s")." nastaveno $count krajů<br>\n";
break;
case "rc":
$osoba[jmeno]='jm';
$osoba[prijmeni]='pr';
$osoba[narozeni]='1967-11-19';
$osoba[pohlavi]='Z';
$osoba[cizinec]='N';
$osoba[rc]='6711191553';
kontrola_osoby($osoba);
echo '<pre>';
var_dump($osoba);
示例5: page_counter
function page_counter($id, $table, $sort, $view_number, $sess, $link, $i, $page)
{
$count = MySQL_Query("SELECT {$id} FROM {$table} WHERE {$sort} AND ul_group = '{$sess['4']}'") or die($query_error);
//vybíráme zprávy
$page_count = Ceil(MySQL_Num_Rows($count) / $view_number);
//poèet stran, na kterých se zprávy zobrazí
for ($i = 0; $i < $page_count; $i++) {
echo " | ";
if ($page != $i) {
echo "<a href=\"{$link}{$i}\">";
}
echo $i + 1;
if ($page != $i) {
echo '</a> ';
}
}
}
示例6: MySQL_Query
<?php
require_once './inc/func_main.php';
MySQL_Query("CREATE TABLE nw_unread (id int NOT NULL PRIMARY KEY AUTO_INCREMENT, idtable int, idrecord int, iduser int)");
$sql = "SELECT id as 'id' FROM " . DB_PREFIX . "users";
$res = MySQL_Query($sql);
while ($rec_utc = MySQL_Fetch_Assoc($res)) {
MySQL_Query("INSERT INTO nw_unread (idtable,idrecord) SELECT idtable,idrecord FROM nw_unread_" . $rec_utc['id']);
MySQL_Query("UPDATE nw_unread SET iduser = " . $rec_utc['id'] . " WHERE iduser IS NULL;");
MySQL_Query("DROP TABLE nw_unread" . $rec_utc['id']);
echo 'vysledek=' . $rec_utc;
print_r($rec_utc);
debug_zval_dump($rec_utc);
echo '<br />';
}
示例7: filter
function filter()
{
global $f_cat, $f_sort, $f_user, $f_type, $usrinfo, $f_org, $f_my, $f_glob, $f_count;
echo '<div id="filter-wrapper"><form action="audit.php" method="post" id="filter">
<fieldset>
<legend>Filtr</legend>
<p>Vypsat <select name="kategorie">
<option value="0"' . ($f_cat == 0 ? ' selected="selected"' : '') . '>všechny auditní záznamy</option>
<option value="1"' . ($f_cat == 1 ? ' selected="selected"' : '') . '>i s aktualitami</option>
<option value="2"' . ($f_cat == 2 ? ' selected="selected"' : '') . '>prohlížení auditních záznamů</option>
<option value="3"' . ($f_cat == 3 ? ' selected="selected"' : '') . '>manipulaci s osobami</option>
<option value="4"' . ($f_cat == 4 ? ' selected="selected"' : '') . '>manipulaci se skupinami</option>
<option value="5"' . ($f_cat == 5 ? ' selected="selected"' : '') . '>manipulaci s případy</option>
<option value="6"' . ($f_cat == 6 ? ' selected="selected"' : '') . '>manipulaci s hlášeními</option>
</select>
<select name="typ">
<option value="0"' . ($f_type == 0 ? ' selected="selected"' : '') . '>všech typů</option>
<option value="1"' . ($f_type == 1 ? ' selected="selected"' : '') . '>jen zásahy</option>
<option value="2"' . ($f_type == 2 ? ' selected="selected"' : '') . '>bez souborů a poznámek</option>
</select>
provedené uživatelem
<select name="user" id="user">
<option value=0 ' . ($f_user == 0 ? ' selected="selected"' : '') . '>všemi</option>';
$sql_u = "SELECT id, login FROM " . DB_PREFIX . "users WHERE deleted=0 ORDER BY login ASC";
$res_u = MySQL_Query($sql_u);
while ($rec_u = MySQL_Fetch_Assoc($res_u)) {
echo '<option value="' . $rec_u['id'] . '"' . ($rec_u['id'] == $f_user ? ' selected="selected"' : '') . '>' . $rec_u['login'] . '</option>';
}
echo '</select>';
echo 'a seřadit je podle <select name="sort">
<option value="1"' . ($f_sort == 1 ? ' selected="selected"' : '') . '>času vzestupně</option>
<option value="2"' . ($f_sort == 2 ? ' selected="selected"' : '') . '>času sestupně</option>
</select>.</p>';
if ($usrinfo['right_org'] == 1) {
echo '
<label for="org">Zobrazit i zásahy organizátorů</label>
<input type="checkbox" name="org" ' . ($f_org == 1 ? ' checked="checked"' : '') . '/><br/>
<div class="clear"> </div>';
}
echo '<label for="my">Zobrazit i moje zásahy</label>
<input type="checkbox" name="my" ' . ($f_my == 1 ? ' checked="checked"' : '') . '/><br/>
<div class="clear"> </div>
<label for="my">Zobrazit i globální operace</label>
<input type="checkbox" name="glob" ' . ($f_glob == 1 ? ' checked="checked"' : '') . '/><br/>
<div class="clear"> </div>
Zobrazit <input type="text" name="count" size=5 value="' . $f_count . '"> posledních záznamů. (Pro všechny záznamy ponechte pole prázdné).<br/>
<div id="filtersubmit"><input type="submit" name="filter" value="Filtrovat" /></div>
</fieldset>
</form></div><!-- end of #filter-wrapper -->';
}
示例8: DB_insert
function DB_insert ($SQL, &$id)
{ //echo "<P>SQL = ".$SQL."<P>";
$funguje = false;
if (!(DB_spojeni(c_Databaze, $chyba, $spojeni))):
echo "<FONT COLOR=red><B><P>Do�lo k chyb� p�i spojen� s datab�z�.
($chyba)<P></B></FONT><BR>\n";
return false;
endif;
MySQL_Query($SQL);
$id = MySQL_Insert_Id();
DB_odpojeni($spojeni);
return $funguje;
}
示例9: mysql_query
<?php
include "mysql.connect.php";
mysql_query("SET NAMES cp1251");
$valueSearch = $_POST['valueSearch'];
if (isset($_GET['addAppeals'])) {
if ($_GET['addAppeals'] != null) {
$result = mysql_query("SELECT * FROM books WHERE ID=" . $_GET['addAppeals'] . "");
$data = mysql_fetch_array($result);
$updateAppeals = $data['Appeals'] + 1;
$updateLastAppeals = date("d.m.Y");
MySQL_Query("UPDATE `{$database}`.`books` SET `Appeals` = '{$updateAppeals}' WHERE ID=" . $_GET['addAppeals'] . "");
MySQL_Query("UPDATE `{$database}`.`books` SET `LastAppeals` = '{$updateLastAppeals}' WHERE ID=" . $_GET['addAppeals'] . "");
header("Location: " . $data['Link'] . "");
} else {
echo "Не возможно перейти на страницу.";
}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title><?php
if ($valueSearch != null) {
echo "" . $valueSearch . " | ";
}
?>
Library Cube - Special for You</title>
</head>
<body>
示例10: pageStart
if (isset($_POST['uploadfile'])) {
pageStart('Přiložení souboru');
mainMenu(5);
sparklets('<a href="./persons.php">osoby</a> » <a href="./editperson.php?rid=' . $_POST['personid'] . '">úprava osoby</a> » <strong>přiložení souboru neúspěšné</strong>');
echo '<div id="obsah"><p>Soubor nebyl přiložen, něco se nepodařilo. Možná nebyl zvolen přikládaný soubor.</p></div>';
pageEnd();
}
}
if (isset($_GET['deletefile']) && is_numeric($_GET['deletefile'])) {
auditTrail(1, 5, $_POST['personid']);
if ($usrinfo['right_text']) {
$fres = MySQL_Query("SELECT uniquename FROM " . DB_PREFIX . "data WHERE " . DB_PREFIX . "data.id=" . $_GET['deletefile']);
$frec = MySQL_Fetch_Assoc($fres);
UnLink('./files/' . $frec['uniquename']);
MySQL_Query("DELETE FROM " . DB_PREFIX . "data WHERE " . DB_PREFIX . "data.id=" . $_GET['deletefile']);
}
Header('Location: editperson.php?rid=' . $_GET['personid']);
}
if (isset($_GET['deletesymbol'])) {
auditTrail(1, 2, $_GET['personid']);
if ($usrinfo['right_text']) {
$sps = MySQL_Query("SELECT symbol FROM " . DB_PREFIX . "persons WHERE id=" . $_GET['personid']);
$spc = MySQL_Fetch_Assoc($sps);
$prsn_res = MySQL_Query("SELECT name, surname FROM " . DB_PREFIX . "persons WHERE id=" . $_GET['personid']);
$prsn_rec = MySQL_Fetch_Assoc($prsn_res);
$sdate = "<p>" . Date("j/m/Y H:i:s", Time()) . " Odpojeno od " . $prsn_rec['name'] . " " . $prsn_rec['surname'] . "</p>";
MySQL_Query("UPDATE " . DB_PREFIX . "symbols SET `desc` = concat('" . $sdate . "', `desc`), assigned=0 WHERE id=" . $spc['symbol']);
MySQL_Query("UPDATE " . DB_PREFIX . "persons SET symbol='' WHERE id=" . $_GET['personid']);
}
Header('Location: editperson.php?rid=' . $_GET['personid']);
}
示例11: pageStart
} else {
if (isset($_POST['insertuser'])) {
pageStart('Přidán uživatel');
mainMenu(2);
sparklets('<a href="./users.php">uživatelé</a> » <a href="./newuser.php">nový uživatel</a> » <strong>přidán uživatel</strong>');
echo '<div id="obsah"><p>Chyba při vytváření, ujistěte se, že jste vše provedli správně a máte potřebná práva.</p></div>';
pageEnd();
}
}
if (isset($_POST['userid']) && isset($_POST['edituser']) && $usrinfo['right_power'] && !preg_match('/^[[:blank:]]*$/i', $_POST['login']) && is_numeric($_POST['power']) && is_numeric($_POST['texty'])) {
auditTrail(8, 2, $_POST['userid']);
pageStart('Uložení změn');
mainMenu(2);
sparklets('<a href="./users.php">uživatelé</a> » <a href="./edituser.php">úprava uživatele</a> » <strong>uložení změn</strong>');
$ures = MySQL_Query("SELECT id FROM " . DB_PREFIX . "users WHERE UCASE(login)=UCASE('" . mysql_real_escape_string(safeInput($_POST['login'])) . "') AND id<>" . $_POST['userid']);
if (MySQL_Num_Rows($ures)) {
echo '<div id="obsah"><p>Uživatel již existuje, změňte jeho jméno.</p></div>';
} else {
MySQL_Query("UPDATE " . DB_PREFIX . "users SET login='" . mysql_real_escape_string(safeInput($_POST['login'])) . "', right_power='" . $_POST['power'] . "', right_text='" . $_POST['texty'] . "', idperson='" . $_POST['idperson'] . "' WHERE id=" . $_POST['userid']);
echo '<div id="obsah"><p>Uživatel upraven.</p></div>';
}
pageEnd();
} else {
if (isset($_POST['edituser'])) {
pageStart('Uložení změn');
mainMenu(2);
sparklets('<a href="./users.php">uživatelé</a> » <a href="./edituser.php">úprava uživatele</a> » <strong>uložení změn</strong>');
echo '<div id="obsah"><p>Chyba při ukládání změn, ujistěte se, že jste vše provedli správně a máte potřebná práva.</p></div>';
pageEnd();
}
}
示例12: MySQL_Query
<?php
require_once './inc/func_main.php';
$sql = "SELECT id as 'id' FROM " . DB_PREFIX . "users";
$res = MySQL_Query($sql);
while ($rec_utc = MySQL_Fetch_Assoc($res)) {
MySQL_Query("CREATE TABLE nw_unread_" . $rec_utc['id'] . " (id int NOT NULL PRIMARY KEY AUTO_INCREMENT, idtable int, idrecord int)");
echo 'vysledek=' . $rec_utc;
print_r($rec_utc);
debug_zval_dump($rec_utc);
echo '<br />';
}
示例13: announces_print_subsections
announces_print_subsections($sub_sel, $sess);
}
} else {
// user listing of announces
announces_print_user($uoz, $sess);
}
?>
<tr>
<td colspan="6">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td colspan="2"><hr size="3" noshade></td></tr>
</tr>
<td>
<b><?php
$message = MySQL_Query("SELECT * FROM lets_skupiny WHERE s_id = '{$sess['4']}'") or die($query_error);
//vybíráme zprávy - seøazeno podle id
$entry = MySQL_Fetch_Row($message);
echo $entry[1];
?>
</b>
</td>
<td align="right">
<b>uniLETIM</b>
<?php
$date = date("Y-m-d");
$date = Explode("-", $date);
echo " " . $date[2] . ". " . $date[1] . ". " . $date[0] . "";
?>
</td>
</tr>
示例14: MySQL_Num_Rows
$memberExists = MySQL_Num_Rows(MySQL_Query("SELECT mbr_id FROM uniletim_members")) ? 1 : 0;
if (!$memberExists) {
include "./install.php";
exit;
}
if ($lang == "") {
$lang = $app_lang;
}
} else {
$lang = $sess[9];
$MSQ = MySQL_Query("UPDATE uniletim_auth SET aut_date = {$date} WHERE aut_id = '{$sid}'");
}
// change group
if ($group_ch != "") {
mysql_query("UPDATE uniletim_auth SET aut_group='{$group_ch}', aut_group_name='{$grp_name}' WHERE aut_id='{$sess['0']}'");
$MSQ = MySQL_Query("SELECT * FROM uniletim_auth WHERE (aut_id = '{$sid}')");
// AND (aut_date >= '$ad')
$sess = mysql_fetch_row($MSQ);
}
// included files
include "language/lang-{$lang}.php";
include "./includes/page.inc.php";
include "./includes/announces.inc.php";
include "./includes/members.inc.php";
if ($action == "print") {
include "./includes/announces-print.inc.php";
// printing of announces
announces_print($sess, $uoz, $rub, $pri, $keyword, $age);
} else {
include "./includes/admin.inc.php";
if (!$menu) {
示例15: SubStr
// in the terms of the Vseobecna zverejnovacia licencia GNU) as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or visit http://www.gnu.sk/ for Vseobecna zverejnovacia licencia GNU
//odstraníme nebezpeèné znaky
$zaco = SubStr($zacof, 0, 1500);
//bereme pouze 1500 znakù
$zaco = Trim($zaco);
//odstraníme mezery ze zaèátku a konce øetìzce
$zaco = HTMLSpecialChars($zaco);
//odstraníme nebezpeèné znaky
$zaco = Str_Replace("\r\n", " <BR> ", $zaco);
//nahradíme konce øádkù na tagy <BR>
$zacof = WordWrap($zaco, 90, "\n", 1);
//rozdìlíme dlouhá slova
$kedyf = Date("Y-m-d");
//kedy
@($tsi = time());
include "./config.php";
$kolkof = Str_Replace(",", ".", $kolkof);
$kolkof = abs($kolkof);
$add = MySQL_Query("INSERT INTO uniletim_services VALUES ('', '{$ktof}', '{$komuf}', '{$kedyf}', '{$zacof}', '{$kolkof}', '{$tsi}', '{$lgr}')") or die($query_error1);
//vložíme zprávu
$ads = MySQL_Query("select * from uniletim_services where ser_time like '{$tsi}' AND ul_group = '{$sess['4']}'") or die($query_error2);
$adk = mysql_fetch_row($ads);
$result = _PAYMENT_SCSFL;
//zavøeme databázi
MySQL_Close();
header("Location: ./platby.php?pres=pl");