本文整理汇总了PHP中adjust_autoincr函数的典型用法代码示例。如果您正苦于以下问题:PHP adjust_autoincr函数的具体用法?PHP adjust_autoincr怎么用?PHP adjust_autoincr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了adjust_autoincr函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runsql
}
}
}
// DEL
if (isset($_REQUEST['del'])) {
$message = runsql('delete from archivedtexts where AtID = ' . $_REQUEST['del'], "Archived Texts deleted");
adjust_autoincr('archivedtexts', 'AtID');
runsql("DELETE archtexttags FROM (archtexttags LEFT JOIN archivedtexts on AgAtID = AtID) WHERE AtID IS NULL", '');
} elseif (isset($_REQUEST['unarch'])) {
$message2 = runsql('insert into texts (TxLgID, TxTitle, TxText, TxAudioURI) select AtLgID, AtTitle, AtText, AtAudioURI from archivedtexts where AtID = ' . $_REQUEST['unarch'], "Texts added");
$id = get_last_key();
runsql('insert into texttags (TtTxID, TtT2ID) select ' . $id . ', AgT2ID from archtexttags where AgAtID = ' . $_REQUEST['unarch'], "");
splitText(get_first_value('select TxText as value from texts where TxID = ' . $id), get_first_value('select TxLgID as value from texts where TxID = ' . $id), $id);
$message1 = runsql('delete from archivedtexts where AtID = ' . $_REQUEST['unarch'], "Archived Texts deleted");
$message = $message1 . " / " . $message2 . " / Sentences added: " . get_first_value('select count(*) as value from sentences where SeTxID = ' . $id) . " / Text items added: " . get_first_value('select count(*) as value from textitems where TiTxID = ' . $id);
adjust_autoincr('archivedtexts', 'AtID');
runsql("DELETE archtexttags FROM (archtexttags LEFT JOIN archivedtexts on AgAtID = AtID) WHERE AtID IS NULL", '');
} elseif (isset($_REQUEST['op'])) {
// UPDATE
if ($_REQUEST['op'] == 'Change') {
$message = runsql('update archivedtexts set ' . 'AtLgID = ' . $_REQUEST["AtLgID"] . ', ' . 'AtTitle = ' . convert_string_to_sqlsyntax($_REQUEST["AtTitle"]) . ', ' . 'AtText = ' . convert_string_to_sqlsyntax($_REQUEST["AtText"]) . ', ' . 'AtAudioURI = ' . convert_string_to_sqlsyntax($_REQUEST["AtAudioURI"]) . ' ' . 'where AtID = ' . $_REQUEST["AtID"], "Updated");
$id = $_REQUEST["AtID"];
}
saveArchivedTextTags($id);
}
// CHG
if (isset($_REQUEST['chg'])) {
$sql = 'select AtLgID, AtTitle, AtText, AtAudioURI from archivedtexts where AtID = ' . $_REQUEST['chg'];
$res = mysql_query($sql);
if ($res == FALSE) {
die("Invalid Query: {$sql}");
示例2: runsql
}
}
// ALL ACTIONS
if (isset($_REQUEST['allaction'])) {
$allaction = $_REQUEST['allaction'];
if ($allaction == 'delall') {
$message = runsql('delete from tags2 where (1=1) ' . $wh_query, "Deleted");
runsql("DELETE texttags FROM (texttags LEFT JOIN tags2 on TtT2ID = T2ID) WHERE T2ID IS NULL", '');
runsql("DELETE archtexttags FROM (archtexttags LEFT JOIN tags2 on AgT2ID = T2ID) WHERE T2ID IS NULL", '');
adjust_autoincr('tags2', 'T2ID');
}
} elseif (isset($_REQUEST['del'])) {
$message = runsql('delete from tags2 where T2ID = ' . $_REQUEST['del'], "Deleted");
runsql("DELETE texttags FROM (texttags LEFT JOIN tags2 on TtT2ID = T2ID) WHERE T2ID IS NULL", '');
runsql("DELETE archtexttags FROM (archtexttags LEFT JOIN tags2 on AgT2ID = T2ID) WHERE T2ID IS NULL", '');
adjust_autoincr('tags2', 'T2ID');
} elseif (isset($_REQUEST['op'])) {
// INSERT
if ($_REQUEST['op'] == 'Save') {
$message = runsql('insert into tags2 (T2Text, T2Comment) values(' . convert_string_to_sqlsyntax($_REQUEST["T2Text"]) . ', ' . convert_string_to_sqlsyntax_nonull($_REQUEST["T2Comment"]) . ')', "Saved");
} elseif ($_REQUEST['op'] == 'Change') {
$message = runsql('update tags2 set T2Text = ' . convert_string_to_sqlsyntax($_REQUEST["T2Text"]) . ', T2Comment = ' . convert_string_to_sqlsyntax_nonull($_REQUEST["T2Comment"]) . ' where T2ID = ' . $_REQUEST["T2ID"], "Updated");
}
}
// NEW
if (isset($_REQUEST['new'])) {
?>
<h4>New Tag</h4>
<form name="newtag" class="validate" action="<?php
echo $_SERVER['PHP_SELF'];
示例3: runsql
}
}
}
}
// ALL ACTIONS
if (isset($_REQUEST['allaction'])) {
$allaction = $_REQUEST['allaction'];
if ($allaction == 'delall') {
$message = runsql('delete from tags where (1=1) ' . $wh_query, "Deleted");
runsql("DELETE wordtags FROM (wordtags LEFT JOIN tags on WtTgID = TgID) WHERE TgID IS NULL", '');
adjust_autoincr('tags', 'TgID');
}
} elseif (isset($_REQUEST['del'])) {
$message = runsql('delete from tags where TgID = ' . $_REQUEST['del'], "Deleted");
runsql("DELETE wordtags FROM (wordtags LEFT JOIN tags on WtTgID = TgID) WHERE TgID IS NULL", '');
adjust_autoincr('tags', 'TgID');
} elseif (isset($_REQUEST['op'])) {
// INSERT
if ($_REQUEST['op'] == 'Save') {
$message = runsql('insert into tags (TgText, TgComment) values(' . convert_string_to_sqlsyntax($_REQUEST["TgText"]) . ', ' . convert_string_to_sqlsyntax_nonull($_REQUEST["TgComment"]) . ')', "Saved");
} elseif ($_REQUEST['op'] == 'Change') {
$message = runsql('update tags set TgText = ' . convert_string_to_sqlsyntax($_REQUEST["TgText"]) . ', TgComment = ' . convert_string_to_sqlsyntax_nonull($_REQUEST["TgComment"]) . ' where TgID = ' . $_REQUEST["TgID"], "Updated");
}
}
// NEW
if (isset($_REQUEST['new'])) {
?>
<h4>New Tag</h4>
<form name="newtag" class="validate" action="<?php
echo $_SERVER['PHP_SELF'];
示例4: get_first_value
For more information, please refer to [http://unlicense.org/].
***************************************************************/
/**************************************************************
Call: delete_word.php?wid=[wordid]&tid=[textid]
Delete a word
***************************************************************/
require_once 'settings.inc.php';
require_once 'connect.inc.php';
require_once 'dbutils.inc.php';
require_once 'utilities.inc.php';
$tid = $_REQUEST['tid'];
$wid = $_REQUEST['wid'];
$term = get_first_value("select WoText as value from " . $tbpref . "words where WoID = " . $wid);
pagestart("Term: " . $term, false);
$m1 = runsql('delete from ' . $tbpref . 'words where WoID = ' . $wid, '');
adjust_autoincr('words', 'WoID');
echo "<p>OK, term deleted, now unknown (" . $m1 . ").</p>";
?>
<script type="text/javascript">
//<![CDATA[
var context = window.parent.frames['l'].document;
var contexth = window.parent.frames['h'].document;
var title = make_tooltip(<?php
echo prepare_textdata_js($term);
?>
,'','','');
$('.word<?php
echo $wid;
?>
', context).removeClass('status99 status98 status1 status2 status3 status4 status5 word<?php
echo $wid;
示例5: elseif
exit;
} elseif (substr($_REQUEST['op'], 0, 4) == 'Save') {
$message1 = runsql('insert into ' . $tbpref . 'texts (TxLgID, TxTitle, TxText, TxAnnotatedText, TxAudioURI, TxSourceURI) values( ' . $_REQUEST["TxLgID"] . ', ' . convert_string_to_sqlsyntax($_REQUEST["TxTitle"]) . ', ' . convert_string_to_sqlsyntax($_REQUEST["TxText"]) . ", '', " . convert_string_to_sqlsyntax($_REQUEST["TxAudioURI"]) . ', ' . convert_string_to_sqlsyntax($_REQUEST["TxSourceURI"]) . ')', "Saved");
$id = get_last_key();
saveTextTags($id);
} elseif (substr($_REQUEST['op'], 0, 6) == 'Change') {
$oldtext = get_first_value('select TxText as value from ' . $tbpref . 'texts where TxID = ' . $_REQUEST["TxID"]);
$textsdiffer = convert_string_to_sqlsyntax($_REQUEST["TxText"]) != convert_string_to_sqlsyntax($oldtext);
$message1 = runsql('update ' . $tbpref . 'texts set ' . 'TxLgID = ' . $_REQUEST["TxLgID"] . ', ' . 'TxTitle = ' . convert_string_to_sqlsyntax($_REQUEST["TxTitle"]) . ', ' . 'TxText = ' . convert_string_to_sqlsyntax($_REQUEST["TxText"]) . ', ' . 'TxAudioURI = ' . convert_string_to_sqlsyntax($_REQUEST["TxAudioURI"]) . ', ' . 'TxSourceURI = ' . convert_string_to_sqlsyntax($_REQUEST["TxSourceURI"]) . ' ' . 'where TxID = ' . $_REQUEST["TxID"], "Updated");
$id = $_REQUEST["TxID"];
saveTextTags($id);
}
$message2 = runsql('delete from ' . $tbpref . 'sentences where SeTxID = ' . $id, "Sentences deleted");
$message3 = runsql('delete from ' . $tbpref . 'textitems where TiTxID = ' . $id, "Textitems deleted");
adjust_autoincr('sentences', 'SeID');
adjust_autoincr('textitems', 'TiID');
splitCheckText(get_first_value('select TxText as value from ' . $tbpref . 'texts where TxID = ' . $id), $_REQUEST["TxLgID"], $id);
$message = $message1 . " / " . $message2 . " / " . $message3 . " / Sentences added: " . get_first_value('select count(*) as value from ' . $tbpref . 'sentences where SeTxID = ' . $id) . " / Text items added: " . get_first_value('select count(*) as value from ' . $tbpref . 'textitems where TiTxID = ' . $id);
if (substr($_REQUEST['op'], -8) == "and Open") {
header('Location: do_text.php?start=' . $id);
exit;
}
}
}
if (isset($_REQUEST['new'])) {
// NEW
?>
<h4>New Text <a target="_blank" href="info.htm#howtotext"><img src="icn/question-frame.png" title="Help" alt="Help" /></a> </h4>
<script type="text/javascript" src="js/unloadformcheck.js" charset="utf-8"></script>
<form class="validate" action="<?php
示例6: reparse_all_texts
function reparse_all_texts()
{
global $tbpref;
runsql('TRUNCATE ' . $tbpref . 'sentences', '');
runsql('TRUNCATE ' . $tbpref . 'textitems', '');
adjust_autoincr('sentences', 'SeID');
adjust_autoincr('textitems', 'TiID');
$sql = "select TxID, TxLgID from " . $tbpref . "texts";
$res = do_mysql_query($sql);
while ($record = mysql_fetch_assoc($res)) {
$id = $record['TxID'];
splitCheckText(get_first_value('select TxText as value from ' . $tbpref . 'texts where TxID = ' . $id), $record['TxLgID'], $id);
}
mysql_free_result($res);
}
示例7: splitText
$txttxt = $record["TxText"];
splitText($txttxt, $id, $txtid);
}
mysql_free_result($res);
$message = $message2 . " / " . $message3 . " / Sentences added: " . get_first_value('select count(*) as value from sentences where SeLgID = ' . $id) . " / Text items added: " . get_first_value('select count(*) as value from textitems where TiLgID = ' . $id);
}
// DEL
if (isset($_REQUEST['del'])) {
$anztexts = get_first_value('select count(TxID) as value from texts where TxLgID = ' . $_REQUEST['del']);
$anzarchtexts = get_first_value('select count(AtID) as value from archivedtexts where AtLgID = ' . $_REQUEST['del']);
$anzwords = get_first_value('select count(WoID) as value from words where WoLgID = ' . $_REQUEST['del']);
if ($anztexts > 0 || $anzarchtexts > 0 || $anzwords > 0) {
$message = 'You must first delete texts, archived texts and words with this language!';
} else {
$message = runsql('delete from languages where LgID = ' . $_REQUEST['del'], "Deleted");
adjust_autoincr('languages', 'LgID');
}
} elseif (isset($_REQUEST['op'])) {
// INSERT
if ($_REQUEST['op'] == 'Save') {
$message = runsql('insert into languages (LgName, LgDict1URI, LgDict2URI, LgGoogleTranslateURI, LgTextSize, LgCharacterSubstitutions, LgRegexpSplitSentences, LgExceptionsSplitSentences, LgRegexpWordCharacters, LgRemoveSpaces, LgSplitEachChar, LgRightToLeft) values(' . convert_string_to_sqlsyntax($_REQUEST["LgName"]) . ', ' . convert_string_to_sqlsyntax($_REQUEST["LgDict1URI"]) . ', ' . convert_string_to_sqlsyntax($_REQUEST["LgDict2URI"]) . ', ' . convert_string_to_sqlsyntax($_REQUEST["LgGoogleTranslateURI"]) . ', ' . $_REQUEST["LgTextSize"] . ', ' . convert_string_to_sqlsyntax_notrim_nonull($_REQUEST["LgCharacterSubstitutions"]) . ', ' . convert_string_to_sqlsyntax($_REQUEST["LgRegexpSplitSentences"]) . ', ' . convert_string_to_sqlsyntax_notrim_nonull($_REQUEST["LgExceptionsSplitSentences"]) . ', ' . convert_string_to_sqlsyntax($_REQUEST["LgRegexpWordCharacters"]) . ', ' . $_REQUEST["LgRemoveSpaces"] . ', ' . $_REQUEST["LgSplitEachChar"] . ', ' . $_REQUEST["LgRightToLeft"] . ')', 'Saved');
} elseif ($_REQUEST['op'] == 'Change') {
$message = runsql('update languages set ' . 'LgName = ' . convert_string_to_sqlsyntax($_REQUEST["LgName"]) . ', ' . 'LgDict1URI = ' . convert_string_to_sqlsyntax($_REQUEST["LgDict1URI"]) . ', ' . 'LgDict2URI = ' . convert_string_to_sqlsyntax($_REQUEST["LgDict2URI"]) . ', ' . 'LgGoogleTranslateURI = ' . convert_string_to_sqlsyntax($_REQUEST["LgGoogleTranslateURI"]) . ', ' . 'LgTextSize = ' . $_REQUEST["LgTextSize"] . ', ' . 'LgCharacterSubstitutions = ' . convert_string_to_sqlsyntax_notrim_nonull($_REQUEST["LgCharacterSubstitutions"]) . ', ' . 'LgRegexpSplitSentences = ' . convert_string_to_sqlsyntax($_REQUEST["LgRegexpSplitSentences"]) . ', ' . 'LgExceptionsSplitSentences = ' . convert_string_to_sqlsyntax_notrim_nonull($_REQUEST["LgExceptionsSplitSentences"]) . ', ' . 'LgRegexpWordCharacters = ' . convert_string_to_sqlsyntax($_REQUEST["LgRegexpWordCharacters"]) . ', ' . 'LgRemoveSpaces = ' . $_REQUEST["LgRemoveSpaces"] . ', ' . 'LgSplitEachChar = ' . $_REQUEST["LgSplitEachChar"] . ', ' . 'LgRightToLeft = ' . $_REQUEST["LgRightToLeft"] . ' where LgID = ' . $_REQUEST["LgID"], 'Updated');
}
}
// NEW
if (isset($_REQUEST['new'])) {
?>
<h4>New Language <a target="_blank" href="info.htm#howtolang"><img src="icn/question-frame.png" title="Help" alt="Help" /></a> </h4>
<form class="validate" action="<?php
示例8: check_update_db
//.........这里部分代码省略.........
}
if (in_array('tags2', $tables) == FALSE) {
if ($debug) {
echo '<p>DEBUG: rebuilding tags2</p>';
}
runsql("CREATE TABLE IF NOT EXISTS 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, PRIMARY KEY (T2ID), UNIQUE KEY T2Text (T2Text) ) ENGINE=MyISAM DEFAULT CHARSET=utf8", '');
}
if (in_array('texttags', $tables) == FALSE) {
if ($debug) {
echo '<p>DEBUG: rebuilding texttags</p>';
}
runsql("CREATE TABLE IF NOT EXISTS 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('archtexttags', $tables) == FALSE) {
if ($debug) {
echo '<p>DEBUG: rebuilding archtexttags</p>';
}
runsql("CREATE TABLE IF NOT EXISTS 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>';
}
$sql = "select TxID, TxLgID from texts";
$res = mysql_query($sql);
if ($res == FALSE) {
die("Invalid Query: {$sql}");
}
while ($record = mysql_fetch_assoc($res)) {
$id = $record['TxID'];
runsql('delete from sentences where SeTxID = ' . $id, "");
runsql('delete from textitems where TiTxID = ' . $id, "");
adjust_autoincr('sentences', 'SeID');
adjust_autoincr('textitems', 'TiID');
splitText(get_first_value('select TxText as value from texts where TxID = ' . $id), $record['TxLgID'], $id);
}
mysql_free_result($res);
}
// Version
$res = mysql_query("select StValue as value from settings where StKey = 'dbversion'");
if (mysql_errno() != 0) {
die('There is something wrong with your database ' . $dbname . '. Please reinstall.');
}
$record = mysql_fetch_assoc($res);
if ($record) {
$dbversion = $record["value"];
} else {
$dbversion = 'v001000000';
saveSetting('dbversion', $dbversion);
if ($debug) {
echo '<p>DEBUG: DB version not found, set to: ' . $dbversion . '</p>';
}
}
mysql_free_result($res);
// Do DB Updates
$currversion = get_version_number();
if ($currversion > $dbversion) {
if ($currversion > 'v001000000') {
// updates for all versions > 1.0.0
if ($debug) {
echo '<p>DEBUG: Doing db-upgrade ' . $currversion . ' > v001000000</p>';
}
runsql("ALTER TABLE words ADD WoTodayScore DOUBLE NOT NULL DEFAULT 0, ADD WoTomorrowScore DOUBLE NOT NULL DEFAULT 0, ADD WoRandom DOUBLE NOT NULL DEFAULT 0", '');
runsql("ALTER TABLE words ADD INDEX WoTodayScore (WoTodayScore), ADD INDEX WoTomorrowScore (WoTomorrowScore), ADD INDEX WoRandom (WoRandom)", '');
runsql("UPDATE words SET " . make_score_random_insert_update('u'), '');