本文整理汇总了PHP中do_mysql_query函数的典型用法代码示例。如果您正苦于以下问题:PHP do_mysql_query函数的具体用法?PHP do_mysql_query怎么用?PHP do_mysql_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了do_mysql_query函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_first_value
function get_first_value($sql)
{
$res = do_mysql_query($sql);
$record = mysql_fetch_assoc($res);
if ($record) {
$d = $record["value"];
} else {
$d = NULL;
}
mysql_free_result($res);
return $d;
}
示例2: formattext
}
echo "\n<br>" . formattext($row["notice"]);
echo "\n</font>";
echo "\n<br><small><i>Created by " . $row["author"] . " on " . date("l \\t\\h\\e jS \\of F \\a\\t g:ia", strtotime($row["date_added"])) . "</i></small><p>";
}
//if
}
//while
}
echo "\n</td><td width=25% align=right valign=top>";
if (authenticate($username, $password)) {
echo "\n<table width=100%>";
echo "\n<tr bgcolor={$table_heading_bgcolour}><td align=center><b>Event Calendar</b></td></tr>";
$query = "SELECT * FROM {$events_table} WHERE event_date >= '" . date("Y-m-d", time()) . "' ORDER BY event_date";
//echo $query."<br>";
$result = do_mysql_query($query);
while ($row = mysql_fetch_array($result)) {
echo "\n<tr bgcolor={$table_bgcolour}><td><font ";
if ($row["event_date"] == date("Y-m-d", time())) {
echo "color=red";
} else {
echo "color=black";
}
echo ">";
if ($username == "staff" and getVAR("edit") == "on") {
//add edit/del buttons
$id = $row["ID"];
echo "\n<a href=\"{$PHP_SELF}?action=edit_event&display_date={$display_date}&id={$id}&username={$username}&password={$password}\"><img border=0 align=right src=\"images/edit.gif\"> </a> ";
echo "\n<a href=\"{$PHP_SELF}?action=del_event&display_date={$display_date}&id={$id}&username={$username}&password={$password}\"><img border=0 align=right src=\"images/delete.gif\"></a>";
}
echo "\n<small><b>" . strftime("%d/%m/%Y", strtotime($row["event_date"])) . " - " . $row["event"] . "</b><br>" . formattext($row["details"]) . "</small>";
示例3: text
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
For more information, please refer to [http://unlicense.org/].
***************************************************************/
/**************************************************************
Call: display_impr_text_header.php?text=[textid]
Display an improved annotated text (top frame)
***************************************************************/
require_once 'settings.inc.php';
require_once 'connect.inc.php';
require_once 'dbutils.inc.php';
require_once 'utilities.inc.php';
$textid = getreq('text');
$sql = 'select TxLgID, TxTitle, TxAudioURI, TxSourceURI from ' . $tbpref . 'texts where TxID = ' . $textid;
$res = do_mysql_query($sql);
$record = mysql_fetch_assoc($res);
$audio = $record['TxAudioURI'];
if (!isset($audio)) {
$audio = '';
}
$audio = trim($audio);
$title = $record['TxTitle'];
$sourceURI = $record['TxSourceURI'];
$langid = $record['TxLgID'];
mysql_free_result($res);
saveSetting('currenttext', $textid);
pagestart_nobody(tohtml($title));
echo '<h2 class="center" style="margin:5px;margin-top:-10px;">';
?>
示例4: haveaccess
function haveaccess($username, $notice_id)
{
global $users_table, $permissions_table;
$result = do_mysql_query("SELECT * FROM {$users_table} WHERE username='{$username}' LIMIT 1");
$row = mysql_fetch_array($result);
$user_id = $row["ID"];
$tempOutput = FALSE;
$result = do_mysql_query("SELECT * FROM {$permissions_table} WHERE notice_id={$notice_id}");
while ($row = mysql_fetch_array($result)) {
if ($row["user_id"] == $user_id or $row["user_id"] == "-1") {
$tempOutput = TRUE;
}
}
return $tempOutput;
}
示例5: restore_file
$message = restore_file($handle, "Database");
}
// $handle OK
} else {
$message = "Error: No Restore file specified";
}
} elseif (isset($_REQUEST['backup'])) {
$tables = array('archivedtexts', 'archtexttags', 'languages', 'sentences', 'settings', 'tags', 'tags2', 'textitems', 'texts', 'texttags', 'words', 'wordtags');
$fname = "lwt-backup-" . $pref . date('Y-m-d-H-i-s') . ".sql.gz";
$out = "-- " . $fname . "\n";
foreach ($tables as $table) {
// foreach table
$result = do_mysql_query('SELECT * FROM ' . $tbpref . $table);
$num_fields = mysql_num_fields($result);
$out .= "\nDROP TABLE IF EXISTS " . $table . ";\n";
$row2 = mysql_fetch_row(do_mysql_query('SHOW CREATE TABLE ' . $tbpref . $table));
$out .= str_replace($tbpref . $table, $table, str_replace("\n", " ", $row2[1])) . ";\n";
if ($table !== 'sentences' && $table !== 'textitems') {
while ($row = mysql_fetch_row($result)) {
// foreach record
$return = 'INSERT INTO ' . $table . ' VALUES(';
for ($j = 0; $j < $num_fields; $j++) {
// foreach field
if (isset($row[$j])) {
$return .= "'" . mysql_real_escape_string($row[$j]) . "'";
} else {
$return .= 'NULL';
}
if ($j < $num_fields - 1) {
$return .= ',';
}
示例6: check_update_db
function check_update_db()
{
global $debug, $tbpref;
$tables = array();
$res = do_mysql_query(str_replace('_', "\\_", "SHOW TABLES LIKE " . convert_string_to_sqlsyntax_nonull($tbpref . '%')));
while ($row = mysql_fetch_row($res)) {
$tables[] = $row[0];
}
mysql_free_result($res);
$count = 0;
// counter for cache rebuild
// Rebuild Tables if missing (current versions!)
if (in_array($tbpref . 'archivedtexts', $tables) == FALSE) {
if ($debug) {
echo '<p>DEBUG: rebuilding archivedtexts</p>';
}
runsql("CREATE TABLE IF NOT EXISTS " . $tbpref . "archivedtexts ( AtID int(11) unsigned NOT NULL AUTO_INCREMENT, AtLgID int(11) unsigned NOT NULL, AtTitle varchar(200) NOT NULL, AtText text NOT NULL, AtAnnotatedText longtext NOT NULL, AtAudioURI varchar(200) DEFAULT NULL, AtSourceURI varchar(1000) DEFAULT NULL, PRIMARY KEY (AtID), KEY AtLgID (AtLgID) ) ENGINE=MyISAM DEFAULT CHARSET=utf8", '');
}
if (in_array($tbpref . 'languages', $tables) == FALSE) {
if ($debug) {
echo '<p>DEBUG: rebuilding languages</p>';
}
runsql("CREATE TABLE IF NOT EXISTS " . $tbpref . "languages ( LgID int(11) unsigned NOT NULL AUTO_INCREMENT, LgName varchar(40) NOT NULL, LgDict1URI varchar(200) NOT NULL, LgDict2URI varchar(200) DEFAULT NULL, LgGoogleTranslateURI varchar(200) DEFAULT NULL, LgExportTemplate varchar(1000) DEFAULT NULL, LgTextSize int(5) unsigned NOT NULL DEFAULT '100', LgCharacterSubstitutions varchar(500) NOT NULL, LgRegexpSplitSentences varchar(500) NOT NULL, LgExceptionsSplitSentences varchar(500) NOT NULL, LgRegexpWordCharacters varchar(500) NOT NULL, LgRemoveSpaces int(1) unsigned NOT NULL DEFAULT '0', LgSplitEachChar int(1) unsigned NOT NULL DEFAULT '0', LgRightToLeft int(1) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (LgID), UNIQUE KEY LgName (LgName) ) ENGINE=MyISAM DEFAULT CHARSET=utf8", '');
}
if (in_array($tbpref . 'sentences', $tables) == FALSE) {
if ($debug) {
echo '<p>DEBUG: rebuilding sentences</p>';
}
runsql("CREATE TABLE IF NOT EXISTS " . $tbpref . "sentences ( SeID int(11) unsigned NOT NULL AUTO_INCREMENT, SeLgID int(11) unsigned NOT NULL, SeTxID int(11) unsigned NOT NULL, SeOrder int(11) unsigned NOT NULL, SeText text, PRIMARY KEY (SeID), KEY SeLgID (SeLgID), KEY SeTxID (SeTxID), KEY SeOrder (SeOrder) ) ENGINE=MyISAM DEFAULT CHARSET=utf8", '');
$count++;
}
if (in_array($tbpref . 'settings', $tables) == FALSE) {
if ($debug) {
echo '<p>DEBUG: rebuilding settings</p>';
}
runsql("CREATE TABLE IF NOT EXISTS " . $tbpref . "settings ( StKey varchar(40) NOT NULL, StValue varchar(40) DEFAULT NULL, PRIMARY KEY (StKey) ) ENGINE=MyISAM DEFAULT CHARSET=utf8", '');
}
if (in_array($tbpref . 'textitems', $tables) == FALSE) {
if ($debug) {
echo '<p>DEBUG: rebuilding textitems</p>';
}
runsql("CREATE TABLE IF NOT EXISTS " . $tbpref . "textitems ( TiID int(11) unsigned NOT NULL AUTO_INCREMENT, TiLgID int(11) unsigned NOT NULL, TiTxID int(11) unsigned NOT NULL, TiSeID int(11) unsigned NOT NULL, TiOrder int(11) unsigned NOT NULL, TiWordCount int(1) unsigned NOT NULL, TiText varchar(250) NOT NULL, TiTextLC varchar(250) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, TiIsNotWord tinyint(1) NOT NULL, PRIMARY KEY (TiID), KEY TiLgID (TiLgID), KEY TiTxID (TiTxID), KEY TiSeID (TiSeID), KEY TiOrder (TiOrder), KEY TiTextLC (TiTextLC), KEY TiIsNotWord (TiIsNotWord) ) ENGINE=MyISAM DEFAULT CHARSET=utf8", '');
$count++;
}
if (in_array($tbpref . 'texts', $tables) == FALSE) {
if ($debug) {
echo '<p>DEBUG: rebuilding texts</p>';
}
runsql("CREATE TABLE IF NOT EXISTS " . $tbpref . "texts ( TxID int(11) unsigned NOT NULL AUTO_INCREMENT, TxLgID int(11) unsigned NOT NULL, TxTitle varchar(200) NOT NULL, TxText text NOT NULL, TxAnnotatedText longtext NOT NULL, TxAudioURI varchar(200) DEFAULT NULL, TxSourceURI varchar(1000) DEFAULT NULL, PRIMARY KEY (TxID), KEY TxLgID (TxLgID) ) ENGINE=MyISAM DEFAULT CHARSET=utf8", '');
}
if (in_array($tbpref . 'words', $tables) == FALSE) {
if ($debug) {
echo '<p>DEBUG: rebuilding words</p>';
}
runsql("CREATE TABLE IF NOT EXISTS " . $tbpref . "words ( WoID int(11) unsigned NOT NULL AUTO_INCREMENT, WoLgID int(11) unsigned NOT NULL, WoText varchar(250) NOT NULL, WoTextLC varchar(250) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, WoStatus tinyint(4) NOT NULL, WoTranslation varchar(500) NOT NULL DEFAULT '*', WoRomanization varchar(100) DEFAULT NULL, WoSentence varchar(1000) DEFAULT NULL, WoCreated timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, WoStatusChanged timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', WoTodayScore double NOT NULL DEFAULT '0', WoTomorrowScore double NOT NULL DEFAULT '0', WoRandom double NOT NULL DEFAULT '0', PRIMARY KEY (WoID), UNIQUE KEY WoLgIDTextLC (WoLgID,WoTextLC), KEY WoLgID (WoLgID), KEY WoStatus (WoStatus), KEY WoTextLC (WoTextLC), KEY WoTranslation (WoTranslation(333)), KEY WoCreated (WoCreated), KEY WoStatusChanged (WoStatusChanged), KEY WoTodayScore (WoTodayScore), KEY WoTomorrowScore (WoTomorrowScore), KEY WoRandom (WoRandom) ) ENGINE=MyISAM DEFAULT CHARSET=utf8", '');
}
if (in_array($tbpref . 'tags', $tables) == FALSE) {
if ($debug) {
echo '<p>DEBUG: rebuilding tags</p>';
}
runsql("CREATE TABLE IF NOT EXISTS " . $tbpref . "tags ( TgID int(11) unsigned NOT NULL AUTO_INCREMENT, TgText varchar(20) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, TgComment varchar(200) NOT NULL DEFAULT '', PRIMARY KEY (TgID), UNIQUE KEY TgText (TgText) ) ENGINE=MyISAM DEFAULT CHARSET=utf8", '');
}
if (in_array($tbpref . 'wordtags', $tables) == FALSE) {
if ($debug) {
echo '<p>DEBUG: rebuilding wordtags</p>';
}
runsql("CREATE TABLE IF NOT EXISTS " . $tbpref . "wordtags ( WtWoID int(11) unsigned NOT NULL, WtTgID int(11) unsigned NOT NULL, PRIMARY KEY (WtWoID,WtTgID), KEY WtTgID (WtTgID), KEY WtWoID (WtWoID) ) ENGINE=MyISAM DEFAULT CHARSET=utf8", '');
}
if (in_array($tbpref . 'tags2', $tables) == FALSE) {
if ($debug) {
echo '<p>DEBUG: rebuilding tags2</p>';
}
runsql("CREATE TABLE IF NOT EXISTS " . $tbpref . "tags2 ( T2ID int(11) unsigned NOT NULL AUTO_INCREMENT, T2Text varchar(20) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, T2Comment varchar(200) NOT NULL DEFAULT '', PRIMARY KEY (T2ID), UNIQUE KEY T2Text (T2Text) ) ENGINE=MyISAM DEFAULT CHARSET=utf8", '');
}
if (in_array($tbpref . 'texttags', $tables) == FALSE) {
if ($debug) {
echo '<p>DEBUG: rebuilding texttags</p>';
}
runsql("CREATE TABLE IF NOT EXISTS " . $tbpref . "texttags ( TtTxID int(11) unsigned NOT NULL, TtT2ID int(11) unsigned NOT NULL, PRIMARY KEY (TtTxID,TtT2ID), KEY TtTxID (TtTxID), KEY TtT2ID (TtT2ID) ) ENGINE=MyISAM DEFAULT CHARSET=utf8", '');
}
if (in_array($tbpref . 'archtexttags', $tables) == FALSE) {
if ($debug) {
echo '<p>DEBUG: rebuilding archtexttags</p>';
}
runsql("CREATE TABLE IF NOT EXISTS " . $tbpref . "archtexttags ( AgAtID int(11) unsigned NOT NULL, AgT2ID int(11) unsigned NOT NULL, PRIMARY KEY (AgAtID,AgT2ID), KEY AgAtID (AgAtID), KEY AgT2ID (AgT2ID) ) ENGINE=MyISAM DEFAULT CHARSET=utf8", '');
}
if ($count > 0) {
// Rebuild Text Cache if cache tables new
if ($debug) {
echo '<p>DEBUG: rebuilding cache tables</p>';
}
reparse_all_texts();
}
// DB Version
$currversion = get_version_number();
$res = mysql_query("select StValue as value from " . $tbpref . "settings where StKey = 'dbversion'");
if (mysql_errno() != 0) {
my_die('There is something wrong with your database ' . $dbname . '. Please reinstall.');
}
$record = mysql_fetch_assoc($res);
//.........这里部分代码省略.........
示例7: print_similar_terms
function print_similar_terms($lang_id, $compared_term)
{
// Get Term and translation of terms in termid array (calculated
// in function get_similar_terms(...)) as string for echo
global $tbpref;
$max_count = (int) getSettingWithDefault("set-similar-terms-count");
if ($max_count <= 0) {
return '';
}
if (trim($compared_term) == '') {
return ' ';
}
$compare = tohtml($compared_term);
$termarr = get_similar_terms($lang_id, $compared_term, $max_count, 0.33);
$rarr = array();
foreach ($termarr as $termid) {
$sql = "select WoText, WoTranslation, WoRomanization from " . $tbpref . "words where WoID = " . $termid;
$res = do_mysql_query($sql);
if ($record = mysql_fetch_assoc($res)) {
$term = tohtml($record["WoText"]);
if (stripos($compare, $term) !== FALSE) {
$term = '<span class="red3">' . $term . '</span>';
} else {
$term = str_replace($compare, '<span class="red3"><u>' . $compare . '</u></span>', $term);
}
$tra = $record["WoTranslation"];
if ($tra == "*") {
$tra = "???";
}
if (trim($record["WoRomanization"]) !== '') {
$romd = " [" . $record["WoRomanization"] . "]";
$rom = $record["WoRomanization"];
} else {
$romd = "";
$rom = "";
}
$rarr[] = '<img class="clickedit" src="icn/tick-button-small.png" title="Copy → Translation & Romanization Field(s)" onclick="setTransRoman(' . prepare_textdata_js($tra) . ',' . prepare_textdata_js($rom) . ');" /> ' . $term . tohtml($romd) . ' — ' . tohtml($tra) . '<br />';
}
mysql_free_result($res);
}
if (count($rarr) == 0) {
return "(none)";
} else {
return implode($rarr);
}
}
示例8: execute_file_sql
function execute_file_sql($readfunc, $sqlfile, $leftoversql = '')
{
global $executed_sql, $mysql_command;
// get the data from the file
$command_count = 0;
while ($leftoversql !== NULL) {
// get the next statement to be executed
$executed_sql = nextSQLstatement($readfunc, $sqlfile, $leftoversql);
// empty statements, after semi colon removed, should be ignored
// if the statement is there and fails, we stop processing the file
if ($executed_sql) {
// track the number of executed commands
$command_count++;
if (!do_mysql_query($mysql_command)) {
break;
}
}
}
// tell how many commands were executed
return $command_count;
}
示例9: DisplayWorkshopItems
function DisplayWorkshopItems($page = 0, $perpage = 25)
{
global $steamusers, $pubfiles;
global $tb;
if (!is_numeric($perpage) || $perpage < 1) {
$perpage = 25;
}
if ($perpage > 100) {
$perpage = 100;
}
if (!is_numeric($page) || $page < 0) {
$page = 0;
}
$result = do_mysql_query("SELECT count(result) as total FROM `{$tb['prefix']}{$tb['pubfiles']}`");
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$total = $row['total'];
echo "({$total}) ";
$last = floor($total / $perpage);
if ($page > $last) {
$page = $last;
$start = $total - $perpage;
} else {
$start = $page * $perpage;
}
echo "({$start}) ";
$result = do_mysql_query("SELECT * FROM `steam_users`");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$steamusers[$row['steamID64']] = $row;
}
if ($_REQUEST['command'] == 'steamid') {
$result = do_mysql_query("SELECT creator FROM `{$tb['prefix']}{$tb['pubfiles']}`");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
GetSteamUsernameFromUID($row['creator']);
}
}
$result = do_mysql_query("SELECT * FROM `{$tb['prefix']}{$tb['pubfiles']}` LIMIT {$start}, {$perpage}");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$pubfiles[$row['publishedfileid']] = $row;
}
//'result','publishedfileid','creator','creator_appid','consumer_appid','consumer_shortcutid','filename','file_size','preview_file_size','file_url','preview_url','url','hcontent_file','hcontent_preview','title','short_description','time_created','time_updated','visibility','flags','workshop_file','workshop_accepted','show_subscribe_all','num_comments_developer','num_comments_public','banned','ban_reason','banner','can_be_deleted','incompatible','app_name','file_type','can_subscribe','subscriptions','favorited','followers','lifetime_subscriptions','lifetime_favorited','lifetime_followers','views','spoiler_tag','num_children','num_reports','tags',
$fields = array('title', 'creator', 'preview_url', 'short_description', 'time_created', 'time_updated', 'filename', 'file_size', 'preview_file_size');
if ($page) {
if ($page > 1) {
echo "<a href='workshop.php?perpage={$perpage}&page=0'>[0]</a> ";
}
$prev = $page - 1;
echo "<a href='workshop.php?perpage={$perpage}&page={$prev}'> [{$prev}]</a> ";
}
echo "<b>[{$page}]</b>";
if ($page < $last) {
$next = $page + 1;
echo " <a href='workshop.php?perpage={$perpage}&page={$next}'>[{$next}]</a> ";
echo " <a href='workshop.php?perpage={$perpage}&page={$last}'>[{$last}]</a> ({$total})";
}
echo "<table border='1' bordercolor='#000000' cellspacing='0' cellpadding='1'><tr>";
foreach ($fields as $key) {
echo "<th>{$key}</th>";
}
echo "</tr>\n";
foreach ($pubfiles as $pubfile) {
echo "<tr>";
foreach ($fields as $key) {
$val = $pubfile[$key];
switch ($key) {
case 'creator':
$name = GetSteamUsernameFromUID($val);
// var_dump($name,$steamusers);
$val = "<a href='{$steamusers[$val]['url']}' target='_blank'>{$name}</a>";
break;
case 'time_created':
case 'time_updated':
$val = date("Y-m-d h:i", $val);
break;
case 'filename':
$val = "<a href='{$pubfile['file_url']}' target='_blank'>{$val}</a>";
break;
case 'preview_url':
$val = "<img src='{$val}' height='100' width='100'>";
break;
case 'file_size':
case 'preview_file_size':
$val = formatBytes($val);
break;
}
echo "<td>{$val}</td>";
}
echo "</tr>\n";
}
echo "</table>";
//http://steamcommunity.com/sharedfiles/downloadfile/?id=
}