本文整理汇总了PHP中runsql函数的典型用法代码示例。如果您正苦于以下问题:PHP runsql函数的具体用法?PHP runsql怎么用?PHP runsql使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了runsql函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: first_schedule
function first_schedule($tournament, $members, $numplayers)
{
global $stage, $id, $fights, $num;
$id = $tournament;
$q = select("select * from ft_tournaments where TournamentID='{$id}'");
if ($q[StatusID] != 0) {
return 0;
}
if ($members + 1 != $numplayers) {
return 0;
}
$r = select("select * from ft_stages where TournamentTypeID={$q['TournamentTypeID']} and Tour1=1 limit 0,1");
$res2 = runsql("select * from ft_tournament_members where TournamentID='{$id}' order by rand()");
for ($k = 1; $k <= $numplayers; $k++) {
$r2 = mysql_fetch_array($res2);
$users[$k] = $r2[UserID];
}
if ($r[TypeID] == 0) {
for ($k = 1; $k <= $numplayers; $k++) {
runsql("update ft_tmp_agreements set UserID1='{$users[$k]}',\nLogin1=(select concat(if(GuildID>0 and GuildStatusID=1,concat('<img src=/images/gd_guilds/small/',GuildID,'.jpg border=0 align=absmiddle>','</a> '),''),'<a href=/users/',UserID,'/>',Login,'</a>') from ut_users where UserID='{$users[$k]}') \n where TournamentID='{$id}' and Tour=1 and Pair1='{$k}'");
runsql("update ft_tmp_agreements set UserID2='{$users[$k]}',\nLogin2=(select concat(if(GuildID>0 and GuildStatusID=1,concat('<img src=/images/gd_guilds/small/',GuildID,'.jpg border=0 align=absmiddle>','</a> '),''),'<a href=/users/',UserID,'/>',Login,'</a>') from ut_users where UserID='{$users[$k]}') \n where TournamentID='{$id}' and Tour=1 and Pair2='{$k}'");
}
} else {
for ($k = 1; $k <= $numplayers; $k++) {
runsql("update ft_tmp_agreements set UserID1='{$users[$k]}',\nLogin1=(select concat(if(GuildID>0 and GuildStatusID=1,concat('<img src=/images/gd_guilds/small/',GuildID,'.jpg border=0 align=absmiddle>','</a> '),''),'<a href=/users/',UserID,'/>',Login,'</a>') from ut_users where UserID='{$users[$k]}') \n where TournamentID='{$id}' and Stage=1 and Pair1='{$k}'");
runsql("update ft_tmp_agreements set UserID2='{$users[$k]}',\nLogin2=(select concat(if(GuildID>0 and GuildStatusID=1,concat('<img src=/images/gd_guilds/small/',GuildID,'.jpg border=0 align=absmiddle>','</a> '),''),'<a href=/users/',UserID,'/>',Login,'</a>') from ut_users where UserID='{$users[$k]}') \n where TournamentID='{$id}' and Stage=1 and Pair2='{$k}'");
runsql("update ft_groups set UserID='{$users[$k]}',Login=(select concat(if(GuildID>0 and GuildStatusID=1,concat('<a href=/guilds/',GuildID,'><img src=/images/gd_guilds/small/',GuildID,'.jpg border=0 align=absmiddle>','</a> '),''),'<a href=/users/',UserID,'/>',Login,'</a>') from ut_users where UserID='{$users[$k]}') where TournamentID='{$id}' and Stage=1 and Pair='{$k}'");
}
}
runsql("delete from ft_agreements where TournamentID='{$id}'");
runsql("insert into ft_agreements\n(UserID1,UserID2,TypeID,ExtraGlad,LimitGlad,LimitSkl,Timeout,TournamentID,Stage,Tour,Fight,Pair,NumFights,StageTypeID,Approved,StatusID,Date,Login1,Login2) \n(select UserID1,UserID2,TypeID,ExtraGlad,LimitGlad,LimitSkl,Timeout,TournamentID ,Stage,Tour,Fight,Pair,NumFights,StageTypeID, 1,2,unix_timestamp(),Login1,Login2\nfrom ft_tmp_agreements where TournamentID='{$id}' and Tour=1 and Fight=1)");
runsql("update ft_tournaments set StatusID=1 where TournamentID='{$id}'");
}
示例2: DrawPart
function DrawPart($parent, $pref)
{
$res = runsql("select t.{$this->id},t.Name_\$lang; as Name from {$this->table} t left outer join {$this->table} p on p.{$this->id}=t.{$this->id} where t.Parent='{$parent}' and t.{$this->id}<>t.Parent group by t.{$this->id} order by t.Name_\$lang;");
if (mysql_error()) {
print mysql_error();
exit;
}
while ($r = mysql_fetch_array($res)) {
$num++;
unset($str);
if ($pref) {
$str = "{$pref}";
}
if ($this->numbered == 1) {
$str .= "{$num}.";
} elseif ($parent != '0') {
$str .= " ";
}
if ($this->type == "select") {
print " <option value=\"{$r['0']}\"";
if ($r[0] == $this->val) {
print " selected";
}
print ">{$str} {$r['1']}</option>";
} else {
print "{$str} <a href=\"{$PHP_SELF}?id={$r['0']}\">{$r['1']}</a>";
print "<br>";
}
$r[types] += $this->DrawPart($r[0], $str);
}
return $r[types];
}
示例3: savetag
function savetag($item, $key, $wid)
{
global $tbpref;
if (!in_array($item, $_SESSION['TAGS'])) {
runsql('insert into ' . $tbpref . 'tags (TgText) values(' . convert_string_to_sqlsyntax($item) . ')', "");
get_tags($refresh = 1);
}
runsql('insert ignore into ' . $tbpref . 'wordtags (WtWoID, WtTgID) select ' . $wid . ', TgID from ' . $tbpref . 'tags where TgText = ' . convert_string_to_sqlsyntax($item), "");
}
示例4: update
function update($conn, $tablename, $targettablename, $sql, $count)
{
$recs = reccount($conn, $tablename);
$added = addedcount($conn, $targettablename);
echo "\n Records - " . $recs;
$attempts = get_attempts($recs - $added, $count);
for ($x = 0; $x < $attempts; $x++) {
$start = $added + $x * $count;
$tmp = $sql . " LIMIT " . $start . "," . $count . ";";
//echo "\n" . $tmp;
runsql($conn, $tmp);
}
}
示例5: rec
function rec($id)
{
global $_GET, $type, $_POST;
$q = select("select AnswerID from ut_messages where MessageID='{$id}'");
$row = runsql("select * from ut_messages where MessageID='{$q['0']}'");
if (mysql_num_rows($row)) {
while ($r1 = mysql_fetch_array($row)) {
print "<img src=/images/hr.gif height=10px width=473px style=\"margin-top:5px;margin-bottom:5px\">";
$_GET['id'] = $r1[MessageID];
$f = new cls_form($type, "message");
$f->Draw();
}
rec($q[0]);
}
}
示例6: block_sql
function block_sql($paramarr, $multicachekey = '', $returncount = 0)
{
global $_G, $_SGLOBAL, $_GET, $_SERVER;
if (!empty($paramarr['sql'])) {
require_once B_ROOT . './source/function/block_sql.func.php';
if ($returncount > 0) {
return runsql($paramarr, '', 1);
}
list($sqlstring, $listcount) = runsql($paramarr, '', 0, $multicachekey);
if (!empty($paramarr['perpage'])) {
if ($listcount) {
$urlarr = $_GET;
foreach ($urlarr as $key => $value) {
if (empty($value)) {
unset($urlarr[$key]);
} else {
$urlarr[$key] = rawurlencode($urlarr[$key]);
}
}
unset($urlarr['page']);
$phpurl = arraytostring($urlarr, '=', '&');
$phpurl = $phpurl ? 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '?' . $phpurl : 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
$theblockarr['multipage'] = multi($listcount, $paramarr['perpage'], $_GET['page'], rawurldecode($phpurl), 1);
$theblockarr['listcount'] = $listcount;
}
}
}
//查詢數據
if ($listcount) {
//查詢
$query = DB::query($sqlstring);
while ($value = DB::fetch($query)) {
if (isset($value['subjectimage'])) {
$value['thumb'] = getattachurl($value['subjectimage'], 1);
$value['subjectimage'] = getattachurl($value['subjectimage']);
}
$theblockarr[] = $value;
}
}
return $theblockarr;
}
示例7: drawpanel
function drawpanel($id, $blocks)
{
global $auth, $lang;
print "<center><table border=0 cellspacing=0 cellpadding=5><td valign=top width=160px>";
$res = runsql("select m1.*,m1.Name_{$lang} as name,count(m2.MenuID) as cnt from en_menu m1\n\nleft outer join en_menu m2 on m2.Parent=m1.MenuID\nwhere m1.Parent='{$id}'\ngroup by m1.MenuID\n order by Rang");
$num = 0;
while ($r = mysql_fetch_array($res)) {
if ($r[cnt] > 0) {
if ($num > 0 && $num % $blocks == 0 && $num < $blocks * 3) {
print "</td><td valign=top width=160px>";
}
$num++;
print "<table border=0 width=100% cellspacing=1 cellpadding=3 bgcolor=d3d3d3 ><td class=header>";
$r = printmenu($r);
print "<center><b>{$r['name']}</b></a></center>";
print "</td></table>";
$res1 = runsql("select m1.*,m1.Name_{$lang} as name,count(m2.MenuID) as cnt from en_menu m1\n\nleft outer join en_menu m2 on m2.Parent=m1.MenuID\nwhere m1.Parent='{$r['MenuID']}'\ngroup by m1.MenuID\n order by Rang");
while ($r1 = mysql_fetch_array($res1)) {
print "<table border=0 width=100% cellspacing=1 cellpadding=3 bgcolor=d3d3d3 ><td bgcolor=FFFAE4>";
$r1 = printmenu($r1);
if (!$r1[cnt]) {
print "» <a href=\"{$r1['Url']}\" {$r1['Target']}>{$r1['name']}</a><br>";
} else {
print "» {$r1['name']}<br>";
}
$res2 = runsql("select *,Name_{$lang} as name from en_menu where Name_{$lang}<>'{$r1['Name']}' and Parent='{$r1['MenuID']}' order by Rang");
while ($r2 = mysql_fetch_array($res2)) {
$r2 = printmenu($r2);
print " - <a href=\"{$r2['Url']}\" {$r2['Target']}>{$r2['name']}</a><br>";
}
print "</td></table>";
}
print "<br>";
}
}
print "</table>";
}
示例8: session_start
<?php
include "../include/functions.php";
include "../include/db.php";
?>
<?php
include "../include/params.php";
include "../include/dictionary2.php";
session_start();
opendb();
$opis = getQUERY("o");
$rbr = getQUERY("rbr");
$h = getQUERY("h");
$ppid = getQUERY("ppid");
$pointkm = getQUERY("pointkm");
$pointtime = getQUERY("pointtime");
$h1 = getQUERY("h1");
$predefined = getQUERY("predefined");
$sqlInsert = "insert into rnalogdetail (opis, ppid, hederid, rbr, poikm, poitime) values ('" . $opis . "', " . $ppid . ", " . $h . ", " . $rbr . ", " . $pointkm . ", " . $pointtime . ") ";
runsql($sqlInsert);
if ($predefined . '' == 'true') {
$sqlInsert = "insert into rnalogdetailpre (opis, ppid, hederid, rbr, poikm, poitime) values ('" . $opis . "', " . $ppid . ", " . $h1 . ", " . $rbr . ", " . $pointkm . ", " . $pointtime . ") ";
runsql($sqlInsert);
}
print "OK";
closedb();
示例9: runsql
?>
]</td></tr>
<?php
$gladiator[Level] = $q[Level];
?>
<form name="distribution" method="post" enctype="multipart/form-data" action="/xml/gladiators/level.php?type=gladiators/train&act=distribution">
<input type="hidden" name="step" value="1"/>
<input type="hidden" name="id" value="<?php
echo $id;
?>
"/>
<?php
$res = runsql("select *,Name_{$lang} as Name from ut_abilities where AbilityID>=1 and AbilityID<=6 order by AbilityID");
while ($r = mysql_fetch_array($res)) {
if ($r[AbilityID] <= 2) {
print "<tr bgcolor=#545E61><td>{$r['Name']}</td><td >" . $gladiator[$r[Ability]] . "</td></tr>";
} else {
print "<tr bgcolor=#545E61><td>{$r['Name']}</td><td>\n<input type=\"button\" onclick=\"changeAbility('{$r['Ability']}',-1)\" id=\"{$r['Ability']}Minus\" class=disabledbutton style=\"width:20;\" value=\"-\"> \n<input type=\"string\" id=\"{$r['Ability']}\" size=\"2\" name=\"{$r['Ability']}\" readonly class=clear style=\"text-align:center;height:16px\" value=\"" . $gladiator[$r[Ability]] . "\"> \n<input type=\"hidden\" id=\"Cur{$r['Ability']}\" value=\"" . $gladiator[$r[Ability]] . "\"> \n<input type=\"button\" onclick=\"changeAbility('{$r['Ability']}',1)\" id=\"{$r['Ability']}Plus\" class=bluebutton style=\"width:20\" value=\"+\"></td>";
}
if ($r[AbilityID] == 2) {
print "<tr bgcolor=#545E61><td colspan=3>" . message(251) . ": <input type=\"string\" size=\"2\" name=\"Points\" id=\"Points\" readonly class=clear value=\"{$points}\" > </td></tr>";
}
}
?>
<tr><td colspan=3 bgcolor=#68717>
<input class=disabledbutton type=submit id="Submit"
value=—охранить onclick="this.disabled = true; this.className='disabledbutton';
document.getElementById('VitMinus').disabled = true;
示例10: runsql
print "\r\n <tr>\r\n <td width=\"130\" align=\"center\" valign=\"top\"><img src=\"{$img_url}?id={$r['MaterialID']}&record=2\" alt=\"\" width=\"69\"></td>\r\n <td valign=\"top\"><h5>" . $r[Title] . "</h5>\r\n <p>" . $r[Headline] . "</p>\r\n <p align=\"right\"><a href=\"{$site_url}" . "news.php?id={$r['MaterialID']}\" class=\"lnk\">подробнее</a></p></td>\r\n </tr>\r\n\t ";
}
?>
</table>
<?php
print "<table width=100% cellspacing=0 cellpadding=2 border=0>";
$form->Pages('');
print "</table>";
?>
</td>
</tr>
<tr>
<td valign="top"><img src="images/mid/shad2.jpg" alt="" width="248" height="27"></td>
</tr>
</table>
<?php
} else {
$res = runsql("select MaterialID,Date,Headline_{$lang} as Headline, Name_{$lang} as Title, Message_{$lang} as Message, Small from ut_materials where MaterialID={$id}");
while ($r = mysql_fetch_array($res)) {
print "\r\n\t\t\t<h3>" . $r[Title] . "</h3><br>";
if ($r[Small]) {
print "<img src=\"{$img_url}?id={$r['MaterialID']}&record=1\" alt=\"{$r['Title']}\" align=\"left\" style=\"margin-right: 6px;\"></img>";
}
print "<p>" . settags($r[Message]) . "</p>";
}
}
require "bottom.php";
示例11: runsql
?>
images/text-guest.gif" alt="" width="172" height="17" border="0"></a></td>
<td><a href="/screenshots.php"><img src="<?php
echo $site_url;
?>
images/text-screenshots.gif" alt="" width="121" height="17" border="0"></a></td>
</tr>
</table>
<?php
if ($type != "main/screenshots") {
?>
<table width="500" border="0" cellspacing="8" cellpadding="0" style="margin: 0px 0px 0px 16px;">
<tr>
<?php
$res = runsql("select ScreenshotID,Name_{$lang} as Name from ut_screenshots order by rand() limit 0,3");
while ($r = mysql_fetch_array($res)) {
?>
<td width="33%" align="center" valign="top">
<?php
print "<a href=\"screen.php?record=14&id={$r['0']}\">";
print "<img src=\"/images/ut_screenshots/small/{$r['0']}.jpg\" border=0 ";
if ($r[Name]) {
print " alt=\"{$r['Name']}\" title=\"{$r['Name']}\"";
}
print "/> \n";
?>
</a></td>
<?php
}
示例12: runsql
<?php
$type = "products";
require "up.php";
if (!$id) {
$id = '3';
}
$res = runsql("select p.*, p.Name_{$lang} as Name, p.Description_{$lang} as Description, t.Name_{$lang} as Type from ut_products p \r\nleft outer join ut_product_types t using(TypeID) where ProductID={$id}");
$r = mysql_fetch_array($res);
print "\r\n\t<h3>" . $r[Name] . "</h3><br>\r\n \t<h5> ласс: " . $r[Type] . "</h5><br>";
if ($r[Image]) {
print "<img src=\"{$img_url}?id={$r['ProductID']}&record=9\"><br>";
}
print settags($r[Description]);
require "bottom.php";
示例13: get_first_value
if ($stchange > 0) {
$stchange = 1;
}
} else {
$stchange = $stchange + 0;
$status = $oldstatus + $stchange;
if ($status < 1) {
$status = 1;
}
if ($status > 5) {
$status = 5;
}
}
$word = get_first_value("select WoText as value from words where WoID = " . $wid);
pagestart("Term: " . $word, false);
$m1 = runsql('update words set WoStatus = ' . $status . ', WoStatusChanged = NOW(),' . make_score_random_insert_update('u') . ' where WoID = ' . $wid, 'Status changed');
$newscore = get_first_value('select greatest(0,round(WoTodayScore,0)) AS value from words where WoID = ' . $wid) + 0;
if ($oldstatus == $status) {
echo '<p>Status ' . get_colored_status_msg($status) . ' not changed.</p>';
} else {
echo '<p>Status changed from ' . get_colored_status_msg($oldstatus) . ' to ' . get_colored_status_msg($status) . '.</p>';
}
echo "<p>Old score was " . $oldscore . ", new score is now " . $newscore . ".</p>";
$totaltests = $_SESSION['testtotal'];
$wrong = $_SESSION['testwrong'];
$correct = $_SESSION['testcorrect'];
$notyettested = $totaltests - $correct - $wrong;
if ($notyettested > 0) {
if ($stchange >= 0) {
$_SESSION['testcorrect']++;
} else {
示例14: select
$type = "city/market";
$_POST['user'] = $user;
$res = select("select MarketDate from ut_users where UserID='{$auth->user}'");
if (date("d", mktime() - 5 * 3600) != date("d", $res[0]) || date("m", mktime() - 5 * 3600) != date("m", $res[0])) {
runsql("update ut_users set MarketDate=unix_timestamp()-5*3600 where UserID='{$auth->user}'");
runsql("delete from ut_slaves where UserID='{$auth->user}'");
runsql("insert into ut_slaves (TypeID, CountryID, Age, Talent, Height, Weight, UserID)\n(select @t:=\n(select TypeID from ut_gladiator_types where TypeID<8 order by rand() limit 1) as TypeID,\n(select CountryID from ut_gladiator_countries where TypeID=@t order by Rate*rand()*rand() desc,Rate desc limit 1) as CountryID,\n@age:=round(18+20*rand()) as Age,\n\n@talent:=if((select @a:=(1000*rand()))>0,\nif(@a<90,1,if(@a<280,2,if(@a<550,3,if(@a<740,4,if(@a<850,5,if(@a<950,6,if(@a<995,7,if(@a<999,8,9)))))))),\nif(@a<90,1,if(@a<280,2,if(@a<550,3,if(@a<740,4,if(@a<850,5,if(@a<950,6,if(@a<995,7,if(@a<999,8,9))))))))\n) as Talent, \n@h:=round(160+30*rand())+(select Height from ut_gladiator_types where TypeID=@t) as Height, \nround(@h-115+50*rand())+(select Weight from ut_gladiator_types where TypeID=@t) as Weight,\n\n'{$auth->user}' as UserID\n\nfrom en_numbers where Number<11)");
$res = runsql("select CountryID,GladiatorID from ut_slaves where UserID='{$auth->user}'");
while ($r = mysql_fetch_array($res)) {
unset($a);
$level = mt_rand(1, 5);
for ($i = 1; $i <= $level * 3; $i++) {
$a[mt_rand(0, 3)] += 1;
}
$n = select("select Name from ut_gladiator_names where CountryID='{$r['CountryID']}' order by rand() limit 1");
runsql("update ut_slaves g set Name='{$n['Name']}',Level='{$level}',Acc=1+'{$a['0']}',Vit=1+'{$a['1']}',Str=1+'{$a['2']}',Dex=1+'{$a['3']}',\nPrice=round(power(1.18,'{$level}')*(12/(10-Talent)-1)*(select Coefficient from ut_gladiator_types where TypeID=g.TypeID)*1.5*EXP((Age-23)*(Age-23)/-200)*100) where GladiatorID='{$r['GladiatorID']}'");
}
}
require $site_path . "up.php";
if ($form_ok) {
$form = new cls_form($type, 'select');
$act = "select";
}
require $site_path . "left.php";
?>
<center><img src="/images/art/market.jpg" width=500px height=300px></center>
<?php
$r1 = select("select sum(Slots) as Slots from tm_buildings where UserID='{$auth->user}'");
foreach ($auth->rst[Gladiators] as $k => $v) {
$t = $v[TypeID];
$q = select("select Slots from ut_gladiator_types where TypeID='{$t}'");
示例15: getSetting
Developed by J. Pierre in 2011.
***************************************************************/
/**************************************************************
Call: delete_mword.php?wid=[wordid]&tid=[textid]
Delete an expression
***************************************************************/
include "connect.inc.php";
include "settings.inc.php";
include "utilities.inc.php";
$showAll = getSetting('showallwords');
$showAll = $showAll == '' ? 1 : ((int) $showAll != 0 ? 1 : 0);
$tid = $_REQUEST['tid'];
$wid = $_REQUEST['wid'];
$word = get_first_value("select WoText as value from words where WoID = " . $wid);
pagestart("Term: " . $word, false);
$m1 = runsql('delete from words where WoID = ' . $wid, '');
adjust_autoincr('words', 'WoID');
echo "<p>OK, term deleted (" . $m1 . ").</p>";
?>
<script type="text/javascript">
//<![CDATA[
var context = window.parent.frames['l'].document;
var contexth = window.parent.frames['h'].document;
$('.word<?php
echo $wid;
?>
', context).removeClass('status1 status2 status3 status4 status5 status98 status99 word<?php
echo $wid;
?>
').addClass('hide').attr('data_status','').attr('data_trans','').attr('data_rom','').attr('data_wid','').attr('title','');
$('#learnstatus', contexth).html('<?php