本文整理汇总了PHP中sql_fetch_row函数的典型用法代码示例。如果您正苦于以下问题:PHP sql_fetch_row函数的具体用法?PHP sql_fetch_row怎么用?PHP sql_fetch_row使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sql_fetch_row函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTemplate
/**
* @return string the actual template name
*/
function getTemplate()
{
// If saved in session use this one
if (isset($_SESSION['template']) && $_SESSION['template'] != false) {
return $_SESSION['template'];
}
//search for a template associated to the current host
$plat_templ = parseTemplateDomain($_SERVER['HTTP_HOST']);
if ($plat_templ != false) {
$_SESSION['template'] = $plat_templ;
return $plat_templ;
}
// search template according to the org_chart_tree option
if (!Docebo::user()->isAnonymous()) {
$qtxt = "SELECT associated_template FROM\r\n\t\t\t%adm_org_chart_tree\r\n\t\t\tWHERE associated_template IS NOT NULL AND\r\n\t\t\tidst_oc IN (" . implode(',', Docebo::user()->getArrSt()) . ")\r\n\t\t\tORDER BY iLeft DESC\r\n\t\t\tLIMIT 0,1";
$re = sql_query($qtxt);
if (mysql_num_rows($re) > 0) {
list($template_code) = sql_fetch_row($re);
setTemplate($template_code);
return $_SESSION['template'];
}
}
// search for the default template
$_SESSION['template'] = getDefaultTemplate();
return $_SESSION['template'];
}
示例2: edithtml
function edithtml()
{
checkPerm('mod');
require_once _base_ . '/lib/lib.form.php';
$query = "\r\n\tSELECT textof\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_htmlfront \r\n\tWHERE id_course = '" . $_SESSION['idCourse'] . "'";
$re_htmlfront = sql_query($query);
$error = false;
if (isset($_POST['save'])) {
if (mysql_num_rows($re_htmlfront) > 0) {
$upd_query = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_htmlfront \r\n\t\t\tSET textof = '" . $_POST['description'] . "'\r\n\t\t\tWHERE id_course = '" . $_SESSION['idCourse'] . "'";
$re = sql_query($upd_query);
} else {
$ins_query = "\r\n\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_htmlfront \r\n\t\t\t( id_course, textof) VALUES \r\n\t\t\t( \t'" . $_SESSION['idCourse'] . "',\r\n\t\t\t\t'" . $_POST['description'] . "' )";
$re = sql_query($ins_query);
}
if ($re) {
Util::jump_to('index.php?modname=htmlfront&op=showhtml&saveok=1');
} else {
$error = true;
}
}
$lang =& DoceboLanguage::createInstance('htmlfront', 'lms');
list($textof) = sql_fetch_row($re_htmlfront);
$title_page = array('index.php?modname=htmlfront&op=showhtml' => $lang->def('_HTMLFRONT'), $lang->def('_MOD'));
$GLOBALS['page']->add(getTitleArea($title_page, 'htmlfront') . '<div class="std_block">' . getBackUi('index.php?modname=htmlfront&op=showhtml', $lang->def('_BACK')) . ($error ? getErrorUi($lang->def('_ERROR_IN_SAVE')) : '') . Form::openForm('formnotes', 'index.php?modname=htmlfront&op=edithtml') . Form::openElementSpace() . Form::getTextarea($lang->def('_TEXTOF'), 'description', 'description', importVar('description', false, $textof)) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
}
示例3: getCountUnreaded
function getCountUnreaded($id_user, $courses, &$last_access)
{
if (empty($courses)) {
return array();
}
$unreaded = array();
$query_unreaded = "\r\n\t\tSELECT idCourse, UNIX_TIMESTAMP(posted) \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_advice \r\n\t\tWHERE author <> '" . $id_user . "' AND idCourse IN ( " . implode(',', $courses) . " ) ";
$re_advice = sql_query($query_unreaded);
if (!mysql_num_rows($re_advice)) {
return array();
}
while (list($id_c, $posted) = sql_fetch_row($re_advice)) {
if (!isset($last_access[$id_c])) {
if (isset($unreaded[$id_c])) {
$unreaded[$id_c]++;
} else {
$unreaded[$id_c] = 1;
}
} elseif ($posted > $last_access[$id_c]) {
if (isset($unreaded[$id_c])) {
$unreaded[$id_c]++;
} else {
$unreaded[$id_c] = 1;
}
}
}
return $unreaded;
}
示例4: getDateClassrooms
protected function getDateClassrooms($id_date)
{
$query = "SELECT DISTINCT classroom" . " FROM %lms_course_date_day" . " WHERE id_date = " . $id_date;
$result = sql_query($query);
$array_classroom = array();
while (list($id_classroom) = sql_fetch_row($result)) {
$array_classroom[$id_classroom] = $id_classroom;
}
$res = '';
$first = true;
if (isset($array_classroom[0])) {
$first = false;
$res .= Lang::t('_NOT_ASSIGNED', 'admin_date');
}
$query = "SELECT name" . " FROM %lms_classroom" . " WHERE idClassroom IN (" . implode(',', $array_classroom) . ")" . " ORDER BY name";
$result = sql_query($query);
while (list($name) = sql_fetch_row($result)) {
if ($first) {
$first = false;
$res .= $name;
} else {
$res .= ', ' . $name;
}
}
return $res;
}
示例5: getMatches
function getMatches($col, $name)
{
global $casen, $table;
if ($casen) {
return "'{$name}'";
}
$name = urlencode($name);
$name = str_replace("%C2", "", $name);
$name = str_replace("%E2%84", "", $name);
foreach (array("[", "]", "{", "}", "(", ")", "<", ">", "\\", "/", ".", ",", "?", "!", "\$", "^", "&", "*", "-", "_", "+", "=", ":", ";", "@", "~", "#", "%", " ") as $ok) {
$name = str_replace(urlencode($ok), $ok, $name);
}
$name = preg_replace("/%[0-9A-F][0-9A-F]/", "_", $name);
/* no matching characters = no point matching */
/* if(strpos($name, "%") === false && strpos($name, "_") === false) return "'$name'"; */
$result = sql_query("SELECT {$col} FROM {$table} WHERE {$col} LIKE '{$name}' GROUP BY {$col}");
$ret = "";
$n = 0;
while ($row = sql_fetch_row($result)) {
if ($n++) {
$ret .= ", ";
}
$ret .= "'{$row[$col]}'";
}
return $ret;
}
示例6: _LS_LocationPage
function _LS_LocationPage()
{
global $dbi, $event, $tdbg;
echo setPageTitle('Manage Locations');
echo '<p>Hier werden die Spielstätten bzw. Locations im gesamten Bundesgebiet angezeigt. Ein Klick auf einen Eintrag ladet diesen zum Bearbeiten.<br><b>Unterhalb</b> der Datenmaske werden zugleich alle eingetragenen Heimmannschaften aus dem LigaSystem angezeigt.</p>';
# SECTION 0 Navigation
echo '<table bgcolor="' . $tdbg . '" cellpadding="2" cellspacing="1"><tr><td id="btnrefresh" bgcolor="white" onclick="initlocationpage()" onMouseOver="mover(this)" onMouseOut="mout(this)">Tabelle neu laden</td>' . '<td></td><td bgcolor="white" id="locbrowseActivity"><i>Ready</i></td>' . '<td></td><td bgcolor="white" id="locsaveActivity"><i>Ready</i></td>' . '</tr></table><br>';
$location_count_result = sql_query('SELECT COUNT(*) FROM tbllocation l, tverband v WHERE l.lrealm_id = v.id', $dbi);
$location_count = 0;
while (list($count) = sql_fetch_row($location_count_result, $dbi)) {
$location_count = $count;
}
$response->page = 1;
$response->total = 1;
$response->records = $location_count;
$i = 0;
$location_result = sql_query('SELECT * FROM tbllocation l, tverband v WHERE l.lrealm_id = v.id', $dbi);
while (list($locid, $lname, $lcity, $lplz, $laddress, $lphone, $lactive, $lrealm_id, $lemail, $lcoordinates, $version, $lkey, $vereinid, $vcode, $vname, $vlogic, $version, $vactive) = sql_fetch_row($location_result, $dbi)) {
$response->rows[$i]['id'] = $locid;
$response->rows[$i]['cell'] = array($locid, $lname, $lcity, $lplz, $laddress, $lphone, $lactive, $lemail, $vname, $lcoordinates, $lrealm_id);
$i++;
}
echo '<div id="locationData" style="display: none;">' . json_encode($response) . '</div>';
echo '<table id="locationTable"></table><div id="locationPager"></div><script> createLocationTable(); </script>';
# SECTION 2 DETAIL VIEW
echo '<div id="frmLocation"><form name="locentry" action="fsaveLocation.php?opcode=save" method="post" target="_blank" onSubmit="submitForm(this);return false;"><fieldset><legend>Location Bearbeiten</legend>';
echo include 'forms/location.php';
echo '</form></div>';
# section 4 BrowseOnSelectedDetail
echo '<h3>Aktuelle Heimmannschaften dieser Spielstätte</h3><div id="axteamtable"></div>';
}
示例7: show
public function show()
{
require_once _base_ . '/lib/lib.navbar.php';
require_once _lms_ . '/lib/lib.middlearea.php';
$ma = new Man_MiddleArea();
$block_list = array();
//if($ma->currentCanAccessObj('user_details_short')) $block_list['user_details_short'] = true;
if ($ma->currentCanAccessObj('user_details_full')) {
$block_list['user_details_full'] = true;
}
if ($ma->currentCanAccessObj('credits')) {
$block_list['credits'] = true;
}
if ($ma->currentCanAccessObj('news')) {
$block_list['news'] = true;
}
$query_home = "SELECT title, description FROM learning_webpages where publish=1 and in_home = 1 AND language = '" . getLanguage() . "' LIMIT 1";
$re_home = sql_query($query_home);
list($titolo, $descrizione) = sql_fetch_row($re_home);
if (!empty($block_list)) {
$this->render('_tabs_block', array('active_tab' => 'home', '_content' => "<div id=\"tabhome_title\"><h1>" . $titolo . "</h1></div><div id=\"tabhome_description\">" . $descrizione . "</div>", 'block_list' => $block_list));
} else {
$this->render('_tabs', array('active_tab' => 'home', '_content' => "<div id=\"tabhome_title\"><h1>" . $titolo . "</h1></div><div id=\"tabhome_description\">" . $descrizione . "</div>"));
}
}
示例8: getLevelOneIntest
function getLevelOneIntest($idMenu)
{
$lang =& DoceboLanguage::createInstance('menu', $this->platform);
$query_menu = "\r\n\t\tSELECT name, image\r\n\t\tFROM " . $this->table_level_one . "\r\n\t\tWHERE idMenu = '" . (int) $idMenu . "'";
$re_menu = sql_query($query_menu);
list($name, $image) = sql_fetch_row($re_menu);
return array('name' => $name != '' ? $lang->def($name) : '', 'image' => getPathImage('framework') . 'area_title/' . $image);
}
示例9: marquetapage
function marquetapage()
{
global $cookie;
if ($cookie[0] != '') {
global $REQUEST_URI, $title, $post, $NPDS_Prefix;
if ($ibid = theme_image("modules/add.gif")) {
$add = $ibid;
} else {
$add = "modules/marquetapage/add.gif";
}
if ($ibid = theme_image("modules/addj.gif")) {
$addj = $ibid;
} else {
$addj = "modules/marquetapage/addj.gif";
}
$result = sql_query("SELECT uri, topic FROM " . $NPDS_Prefix . "marquetapage WHERE uid='{$cookie['0']}' ORDER BY topic ASC");
if (sql_num_rows($result)) {
$tmp_toggle = '<a class="tog" id="show_fav" title="' . translate("Show list") . '"><i id="i_lst_fav" class="fa fa-caret-right fa-2x" ></i></a>';
$content = "\n <script type=\"text/javascript\">\n //<![CDATA[\n tog = function(lst,sho,hid){\n \$(document).on('click', 'a.tog', function() {\n var buttonID = \$(this).attr('id');\n lst_id = \$('#'+lst);\n i_id=\$('#i_'+lst);\n btn_show=\$('#'+sho);\n btn_hide=\$('#'+hid);\n if (buttonID == sho) {\n lst_id.fadeIn(1000);//show();\n btn_show.attr('id',hid)\n btn_show.attr('title','" . translate("Hide list") . "');\n i_id.attr('class','fa fa-caret-up fa-2x');\n } else if (buttonID == hid) {\n lst_id.fadeOut(1000);//hide();\n btn_hide=\$('#'+hid);\n btn_hide.attr('id',sho);\n btn_hide.attr('title','" . translate("Show list") . "');\n i_id.attr('class','fa fa-caret-down fa-2x');\n }\n });\n };\n //]]>\n </script>";
$content .= '
<h6>
<a class="tog" id="show_fav" title="' . translate("Show list") . '"><i id="i_lst_fav" class="fa fa-caret-right fa-2x" ></i> Bookmarks </a><span class="tag tag-pill tag-default pull-right">' . sql_num_rows($result) . '</span>
</h6>
<ul id="lst_fav" style="display:none;" >
<a href="modules.php?ModPath=marquetapage&ModStart=marquetapage&op=supp_all&uri=' . $_SERVER['PHP_SELF'] . '"><i class="fa fa-trash-o text-danger" title="' . translate("Delete") . '" data-toggle="tooltip"></i></a>';
while (list($uri, $topic) = sql_fetch_row($result)) {
$content .= '
<li><a href="' . $uri . '" style="font-size:.7rem;">' . $topic . '</a>
<span class="float-xs-right"><a href="modules.php?ModPath=marquetapage&ModStart=marquetapage&op=supp&uri=' . urlencode($uri) . '"><i class="fa fa-trash-o text-danger" title="' . translate("Delete") . '" data-toggle="tooltip"></i></a></span></li>';
}
$content .= '
</ul>
<script type="text/javascript">
//<![CDATA[
tog("lst_fav","show_fav","hide_fav");
//]]>
</script>';
}
global $block_title;
$uri = urlencode($REQUEST_URI);
if ($post) {
$title .= "/" . $post;
}
if ($title == '') {
$title_MTP = basename(urldecode($uri));
} else {
$title_MTP = $title;
}
$boxTitle = '<span><a href="modules.php?ModPath=marquetapage&ModStart=marquetapage&op=add&uri=' . $uri . '&topic=' . urlencode($title_MTP) . '"><i class="fa fa-bookmark-o " title="' . translate("Add") . ' ' . translate("favourite") . '" data-toggle="tooltip"></i></a></span>';
if ($block_title == '') {
$boxTitle .= ' MarqueTaPage';
} else {
$boxTitle .= ' ' . $block_title;
}
themesidebox($boxTitle, $content);
}
}
示例10: getMasInformacion
function getMasInformacion($id, &$nombre, &$nickfacebook, &$imagen, &$categoria, &$direccion, &$telefono, &$paginaweb)
{
global $dbi;
if (!$id) {
return 0;
}
$result = sql_query("SELECT `nombre`, `nickfacebook`, `imagen`, `categoria`, `direccion`, `telefono`, `paginaweb` FROM `sitios` WHERE " . "`id`='" . $id . "'", $dbi) or die(mysql_error(0));
list($nombre, $nickfacebook, $imagen, $categoria, $direccion, $telefono, $paginaweb) = sql_fetch_row($result);
}
示例11: query_to_hash
function query_to_hash($query)
{
$ret = array();
$result = sql_query_dbg($query);
while ($row = sql_fetch_row($result)) {
$ret[$row[0]] = $row[1];
}
return $ret;
}
示例12: getLOParamArray
/**
* @return array of param
**/
function getLOParamArray($idParam)
{
$query = "SELECT param_name, param_value FROM " . $GLOBALS['prefix_lms'] . "_lo_param " . "WHERE idParam = '" . (int) $idParam . "'";
$rs = sql_query($query) or errorCommunication('getLOParam');
$result = array();
while (list($param_name, $param_value) = sql_fetch_row($rs)) {
$result[$param_name] = $param_value;
}
return $result;
}
示例13: sql_query
function sql_query($ticket_id)
{
global $tts, $user, $name, $prefix, $hlpdsk_prefix;
//load values from db
$query = "select `ticket_number`, \n\t\t`t_assigned`,\n `t_from`,\n `t_stage`,\n `t_category`,\n `t_priority`,\n `t_subject`,\n `t_description`,\n `t_comments`,\n `post_date`,\n `complete`,\n `due_date`,\n `end_date`,\n `change_date`,\n `t_status`,\n `t_sms`,\n `t_email`\n\n\t\twhere \n Ticket_Number='{$this->ticket_nr}'";
if ($result = sql_query($query)) {
list($this->ticket_nr, $this->assigned_id, $this->issuer, $this->stage_id, $this->category_id, $this->priority_id, $this->subject, $this->description, $this->comments, $this->post_date, $this->complete, $this->due_date, $this->end_date, $this->change_date, $this->status_id, $this->notify_priv_msg, $this->notify_email) = sql_fetch_row($result);
}
return $result;
}
示例14: getEditionIdFromCourse
public function getEditionIdFromCourse($id_course)
{
$query = "SELECT id_edition" . " FROM %lms_course_editions" . " WHERE id_course = " . (int) $id_course;
$result = sql_query($query);
$res = array();
while (list($id_edition) = sql_fetch_row($result)) {
$res[$id_edition] = $id_edition;
}
return $res;
}
示例15: firstPage
/**
* @param int $idMain if passed return the first voice of the relative menu
*
* @return array with three element modulename and op that contains the first accessible menu element
* indicate in idMain array( [idMain], [modulename], [op] )
**/
function firstPage($idMain = false)
{
$query_main = "\r\n\tSELECT module.idModule, main.idMain, module.module_name, module.default_op, module.token_associated \r\n\tFROM ( " . $GLOBALS['prefix_lms'] . "_menucourse_main AS main JOIN\r\n\t\t" . $GLOBALS['prefix_lms'] . "_menucourse_under AS un ) JOIN\r\n\t\t" . $GLOBALS['prefix_lms'] . "_module AS module\r\n\tWHERE main.idMain = un.idMain AND un.idModule = module.idModule \r\n\t\tAND main.idCourse = '" . (int) $_SESSION['idCourse'] . "'\r\n\t\tAND un.idCourse = '" . (int) $_SESSION['idCourse'] . "'\r\n\t\t" . ($idMain !== false ? " AND main.idMain='" . $idMain . "' " : '') . "\r\n\tORDER BY main.sequence, un.sequence";
$re_main = sql_query($query_main);
while (list($id_module, $main, $module_name, $default_op, $token) = sql_fetch_row($re_main)) {
if (checkPerm($token, true, $module_name)) {
return array('idModule' => $id_module, 'idMain' => $main, 'modulename' => $module_name, 'op' => $default_op);
}
}
}