当前位置: 首页>>代码示例>>PHP>>正文


PHP sql_row函数代码示例

本文整理汇总了PHP中sql_row函数的典型用法代码示例。如果您正苦于以下问题:PHP sql_row函数的具体用法?PHP sql_row怎么用?PHP sql_row使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sql_row函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ajout_fichier

function ajout_fichier($doc_file, $dest, $cpt_doc, $id_groupe)
{
    global $max_size, $total_max_size;
    /* Vérification du type de fichier */
    $ext = '';
    //if (my_ereg("\.([^.]+)$", $doc_file['name'][$cpt_doc], $match)) {
    if (function_exists("mb_ereg") && mb_ereg("\\.([^.]+)\$", $doc_file['name'][$cpt_doc], $match) || function_exists("ereg") && ereg("\\.([^.]+)\$", $doc_file['name'][$cpt_doc], $match)) {
        $ext = corriger_caracteres(my_strtolower($match[1]));
        $ext = corriger_extension($ext);
    }
    $query = "SELECT id_type FROM ct_types_documents WHERE extension='{$ext}' AND upload='oui'";
    $result = sql_query($query);
    if ($row = @sql_row($result, 0)) {
        $id_type = $row[0];
    } else {
        echo "Erreur : Ce type de fichier n'est pas autorisé en téléchargement.\nSi vous trouvez cela regrettable, contactez l'administrateur.\nIl pourra modifier ce paramétrage dans\n   *Gestion des modules/Cahiers de textes/Types de fichiers autorisés en téléchargement*.";
        die;
    }
    /* Vérification de la taille du fichier */
    $max_size_ko = $max_size / 1024;
    $taille = $doc_file['size'][$cpt_doc];
    if ($taille > $max_size) {
        echo "Erreur : Téléchargement impossible : taille maximale autorisée : " . $max_size_ko . " Ko";
        die;
    }
    if ($taille == 0) {
        echo "Le fichier sélectionné semble vide : transfert impossible.";
        die;
    }
    $query = "SELECT DISTINCT sum(taille) somme FROM ct_documents d, ct_entry e WHERE (e.id_groupe='" . $id_groupe . "' and e.id_ct = d.id_ct)";
    $total = sql_query1($query);
    if ($total + $taille > $total_max_size) {
        echo "Erreur : Téléchargement impossible : espace disque disponible (" . ($total_max_size - $total) / 1024 . " Ko) insuffisant.";
        die;
    }
    /* Crétion du répertoire de destination */
    if (!creer_repertoire($dest)) {
        echo "Erreur : Problème d'écriture sur le répertoire. Veuillez signaler ce problème à l'administrateur du site";
        echo $dest;
        die;
    }
    /* Recopier le fichier */
    $nom_sans_ext = mb_substr(basename($doc_file['name'][$cpt_doc]), 0, mb_strlen(basename($doc_file['name'][$cpt_doc])) - (mb_strlen($ext) + 1));
    $nom_sans_ext = my_ereg_replace("[^.a-zA-Z0-9_=-]+", "_", $nom_sans_ext);
    if (strstr($nom_sans_ext, "..")) {
        echo "Erreur : Problème de transfert : le fichier n'a pas pu être transféré sur le répertoire. Veuillez signaler ce problème à l'administrateur du site";
        die;
    }
    $n = 0;
    while (file_exists($newFile = $dest . "/" . $nom_sans_ext . ($n++ ? '-' . $n : '') . '.' . $ext)) {
    }
    $dest_file_path = $newFile;
    if (!deplacer_fichier_upload($doc_file['tmp_name'][$cpt_doc], $dest_file_path)) {
        echo "Erreur : Problème de transfert : le fichier n'a pas pu être transféré sur le répertoire. Veuillez signaler ce problème à l'administrateur du site";
        die;
    }
    return $dest_file_path;
}
开发者ID:rhertzog,项目名称:lcs,代码行数:58,代码来源:traite_doc.php

示例2: get_hint

function get_hint($params)
{
    $out = '';
    extract($params);
    if (empty($keyword)) {
        return '';
    }
    $lang = !empty(Project::getInstance()->getCurUser()->lang) ? Project::getInstance()->getCurUser()->lang : 'en';
    $hint = sql_row('SELECT * FROM hints WHERE keyword="' . $keyword . '" AND lang="' . $lang . '"');
    if (!empty($hint)) {
        $out = htmlspecialchars($hint['value']);
    }
    if (Project::getInstance()->getCurUser()->access == ACCESS_LEVEL_ADMIN) {
        $out .= ' <span style="font-weight:normal;">(<a href="#" style="text-decoration:none;">?</a>)</span>';
    }
    return $out;
}
开发者ID:andrii888,项目名称:VFXHYIP,代码行数:17,代码来源:smarty_functions.php

示例3: generate_select

         //   if we're adding the very first entry, then it should be an admin;
         //   if we're adding a subsequent entry, then it should be an ordinary user;
         if ($Action == "Edit" && $i == $data[$key] || $Action == "Add" && $initial_user_creation && $i == $max_level || $Action == "Add" && !$initial_user_creation && $i == 1) {
             $params['value'] = $i;
         }
     }
     $params['force_assoc'] = TRUE;
     generate_select($params);
     break;
 case 'area_id':
     $params['disabled'] = $level < $min_user_editing_level;
     $params['options'] = array();
     $result1 = sql_query("select id,area_name from mrbs_area");
     $i = 0;
     $params['options'][0] = "Select Area";
     while ($data1 = sql_row($result1, $i)) {
         $params['options'][$data1[0]] = $data1[1];
         if ($Action == "Edit" && $data1[0] == $data[$key]) {
             // echo "   Current Area :".$data1[1];
             $params["value"] = $data1[0];
         }
         $i++;
     }
     $params['force_assoc'] = TRUE;
     // $params['multiple'] = TRUE;
     generate_select($params);
     break;
 case 'name':
     // you cannot change a username (even your own) unless you have user editing rights
     $params['disabled'] = $level < $min_user_editing_level;
     $params['mandatory'] = TRUE;
开发者ID:Rahul6818,项目名称:mrbs,代码行数:31,代码来源:edit_users.php

示例4: sql_row

<?php

$ACCESS_LEVEL = ACCESS_LEVEL_USER;
include_once DOC_ROOT . '/includes/authorization.php';
$user = sql_row('
			SELECT SQL_CALC_FOUND_ROWS
				' . (PRO_VERSION ? 'users.*' : implode(',', $GLOBALS['USERS_FIELDS'])) . ',
				SUM(IF(t.type="d", t.amount, NULL)) as deposit,
				SUM(IF(t.type="w", t.amount, NULL)) as withdrawal,
				SUM(IF(t.type="e", t.amount, NULL)) as earning,
				SUM(IF(t.type="r", t.amount, NULL)) as referral,
				SUM(IF(t.type="i", t.amount, NULL)) as reinvest,
				SUM(IF(t.type="b", t.amount, NULL)) as bonus
			FROM users
			LEFT JOIN translines as t ON t.user_id = users.id AND t.stamp < ' . Project::getInstance()->getNow() . ' AND t.status > 0
			WHERE users.id="' . Project::getInstance()->getCurUser()->id . '"
			GROUP BY users.id
		');
Project::getInstance()->getSmarty()->assign('user', $user);
Project::getInstance()->showPage('user/account.tpl');
开发者ID:andrii888,项目名称:VFXHYIP,代码行数:20,代码来源:account.php

示例5: sql_version

function sql_version()
{
    $r = sql_query("select version()");
    $v = sql_row($r, 0);
    sql_free($r);
    return "MySQL {$v['0']}";
}
开发者ID:rtsfc,项目名称:moodle-block_mrbs,代码行数:7,代码来源:mysql.php

示例6: sql_query

    }
    echo " done.<br>Updating repeating entries: ";
    $sql = "select id,name,description from mrbs_repeat";
    $repeats_res = sql_query($sql);
    for ($i = 0; $row = sql_row($repeats_res, $i); $i++) {
        $id = $row[0];
        $name = slashes(iconv($encoding, "utf-8", $row[1]));
        $desc = slashes(iconv($encoding, "utf-8", $row[2]));
        $upd_sql = "update mrbs_repeat set name='{$name}',description='{$desc}' where id={$id}";
        sql_command($upd_sql);
        echo ".";
    }
    echo " done.<br>Updating normal entries: ";
    $sql = "select id,name,description from mrbs_entry";
    $entries_res = sql_query($sql);
    for ($i = 0; $row = sql_row($entries_res, $i); $i++) {
        $id = $row[0];
        $name = slashes(iconv($encoding, "utf-8", $row[1]));
        $desc = slashes(iconv($encoding, "utf-8", $row[2]));
        $upd_sql = "update mrbs_entry set name='{$name}',description='{$desc}' where id={$id}";
        sql_command($upd_sql);
        echo ".";
    }
    echo 'done.<p>

    Finished everything, byebye!
';
}
?>
  </body>
</html>
开发者ID:verdurin,项目名称:mrbs-mcr,代码行数:31,代码来源:convert_db_to_utf8.php

示例7: get_area_name

function get_area_name($user, $all = FALSE)
{
    $sql = "SELECT name\n            FROM users\n           WHERE code='{$user}'";
    if (empty($all)) {
        $sql .= " AND disabled=0";
    }
    $sql .= " LIMIT 1";
    $res = sql_query($sql);
    if ($res === FALSE) {
        trigger_error(sql_error(), E_USER_WARNING);
        return FALSE;
    }
    if (sql_count($res) == 0) {
        return NULL;
    }
    $row = sql_row($res, 0);
    return $row[0];
}
开发者ID:cvelayo,项目名称:worklog,代码行数:18,代码来源:temp.php

示例8: location

					min="' . $_POST['min'] . '",
					max="' . $_POST['max'] . '",
					percent="' . $_POST['percent'] . '",
					percent_per="' . $_POST['percent_per'] . '",
					periodicy_value="' . $_POST['periodicy_value'] . '",
					periodicy="' . $_POST['periodicy'] . '",
					term="' . $_POST['term'] . '",
					attempts="' . $_POST['attempts'] . '",
					comment="' . $_POST['comment'] . '",
					type="' . $_POST['type'] . '",
					working_days="' . $_POST['working_days'] . '"
				WHERE id="' . $_POST['id'] . '"
			');
            location($_SERVER['PHP_SELF'], '<p class=imp>Plan <u>' . htmlspecialchars($_POST['name']) . '</u> has been saved!</p>');
        }
        $plan = sql_row('SELECT * FROM plans WHERE id="' . intval($_REQUEST['id']) . '"');
        Project::getInstance()->getSmarty()->assign('plan', stripslashes_array($plan));
        Project::getInstance()->getSmarty()->display('../default/admin/plan_profile.tpl');
        break;
    case 'add':
        if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'save') {
            $_POST = sql_escapeArray($_POST);
            sql_query('
				INSERT INTO plans
				SET
					id=0, 
					name="' . $_POST['name'] . '", 
					min="' . $_POST['min'] . '", 
					max="' . $_POST['max'] . '", 
					percent="' . $_POST['percent'] . '", 
					percent_per="' . $_POST['percent_per'] . '",
开发者ID:andrii888,项目名称:VFXHYIP,代码行数:31,代码来源:plans.php

示例9: include

<?
include('inc/conf.php');
if ($_POST['confirm_x']) {
    switch ($_POST['module']) {
     case 1: header("location: Administrative/Index.html"); break;
     case 2: header("location: DomoUpravitel.php"); break;
     case 3: header("location: Sdrujenie.php"); break;
     case 4: header("location: spravkaDom.php"); break;
     case 5: header("location: spravkaSdr.php"); break;
     case 6: header("location: asoc/index.php"); break;
    }
}


$modules_id = array();
$row = sql_row("SELECT id FROM users WHERE username = '$_SESSION[username]' ");

$result = sql_q("SELECT gu.group_id FROM group_users gu, groups g
                  WHERE gu.group_id = g.id AND gu.user_id = '$row[id]'
                  AND g.status = '1' ORDER BY gu.user_id, gu.group_id");
while ($row = mysql_fetch_array($result)) {
    $result_data = sql_q("SELECT DISTINCT module_id FROM permissions WHERE group_id = '$row[group_id]' ORDER BY module_id");
    while ($row_data = mysql_fetch_array($result_data)) {
        if (!in_array($row_data['module_id'], $modules_id)) {
            array_push($modules_id, $row_data['module_id']);
        }
    }
    mysql_free_result($result_data);
  }
?>
<html>
开发者ID:Vakuu,项目名称:projects,代码行数:31,代码来源:Modules.php

示例10: mrbsGetEntryInfo

function mrbsGetEntryInfo($id)
{
    global $tbl_entry;
    $sql = "SELECT start_time, end_time, entry_type, repeat_id, room_id,\n\t               timestamp, create_by, name, type, description\n                FROM {$tbl_entry} WHERE (ID = {$id})";
    $res = sql_query($sql);
    if (!$res) {
        return;
    }
    $ret = "";
    if (sql_count($res) > 0) {
        $row = sql_row($res, 0);
        $ret["start_time"] = $row[0];
        $ret["end_time"] = $row[1];
        $ret["entry_type"] = $row[2];
        $ret["repeat_id"] = $row[3];
        $ret["room_id"] = $row[4];
        $ret["timestamp"] = $row[5];
        $ret["create_by"] = $row[6];
        $ret["name"] = $row[7];
        $ret["type"] = $row[8];
        $ret["description"] = $row[9];
    }
    sql_free($res);
    return $ret;
}
开发者ID:rtsfc,项目名称:moodle-block_mrbs,代码行数:25,代码来源:mrbs_sql.php

示例11: last_connection

/**
 * Renvoie la date et l'heure de la dernière connexion ou d'une tentative de connexion avec mauvais mot de passe
 * 
 * @global string
 * @return string la date et l'heure
 */
function last_connection()
{
    global $gepiPath;
    global $mysqli;
    $sql = "select START, AUTOCLOSE, REMOTE_ADDR from log where LOGIN = '" . $_SESSION['login'] . "' and SESSION_ID != '" . session_id() . "' order by START desc";
    $res = mysqli_query($mysqli, $sql);
    $r = '';
    if ($res) {
        $row = $res->fetch_row();
        $annee_b = substr($row[0], 0, 4);
        $mois_b = substr($row[0], 5, 2);
        $jour_b = substr($row[0], 8, 2);
        $heures_b = substr($row[0], 11, 2);
        $minutes_b = substr($row[0], 14, 2);
        $secondes_b = substr($row[0], 17, 2);
        if ($row[0] != '') {
            if ($row[1] == "4") {
                $r = "<span style=\"color: red\"><strong>Tentative de connexion le " . $jour_b . "/" . $mois_b . "/" . $annee_b . " à " . $heures_b . " h " . $minutes_b . " avec un mot de passe erroné</strong></span> (<a href='" . $gepiPath . "/utilisateurs/mon_compte.php#connexion'" . insert_confirm_abandon() . ">journal des connexions</a>)";
                // On compte le nombre de tentatives infructueuses successives
                $nb_tentative = 0;
                $flag = 0;
                for ($i = 0; $row_b = sql_row($res, $i) and $flag < 1; $i++) {
                    if ($row_b[1] == "2" and $row_b[2] == $row[2]) {
                        $nb_tentative++;
                    } else {
                        $flag = 1;
                    }
                }
                if ($nb_tentative > 1) {
                    $r .= "<br /><strong>Nombre de tentatives de connexion successives : " . $nb_tentative . ".</strong></font>";
                }
            } else {
                $r = "  Dernière session ouverte le " . $jour_b . "/" . $mois_b . "/" . $annee_b . " à " . $heures_b . " h " . $minutes_b . " (<a href='" . $gepiPath . "/utilisateurs/mon_compte.php#connexion'" . insert_confirm_abandon() . ">journal des connexions</a>)";
            }
        }
    }
    $res->close();
    return $r;
}
开发者ID:rhertzog,项目名称:lcs,代码行数:45,代码来源:header_template.inc.php

示例12: htmlspecialchars

    if ($has_next) {
        echo "</A>";
    }
}
?>
  <P>
  <TABLE BORDER=2 CELLSPACING=0 CELLPADDING=3>
   <TR>
    <TH><? echo $lang["entry"]       ?></TH>
    <TH><? echo $lang["createdby"]   ?></TH>
    <TH><? echo $lang["namebooker"]  ?></TH>
    <TH><? echo $lang["description"] ?></TH>
    <TH><? echo $lang["start_date"]  ?></TH>
   </TR>
<?
for ($i = 0; ($row = sql_row($result, $i)); $i++)
{
	echo "<TR>";
	echo "<TD><A HREF=\"view_entry.php?id=$row[0]\">$lang[view]</A></TD>\n";
	echo "<TD>" . htmlspecialchars($row[1]) . "</TD>\n";
	echo "<TD>" . htmlspecialchars($row[2]) . "</TD>\n";
	echo "<TD>" . htmlspecialchars($row[3]) . "</TD>\n";
	// generate a link to the day.php
	$link = getdate($row[4]);
	echo "<TD><A HREF=\"day.php?day=$link[mday]&month=$link[mon]&year=$link[year]&area=$row[5]\">"
	.  strftime('%X - %A %d %B %Y', $row[4]) . "</A></TD>";
	echo "</TR>\n";
}

echo "</TABLE>\n";
include "trailer.inc";
开发者ID:verdurin,项目名称:mrbs-mcr,代码行数:31,代码来源:search.php

示例13: getXML

 public function getXML()
 {
     $dates = sql_row('select min(stamp), max(stamp) from translines where type in ("w", "d") and status in (1, 2)');
     $start_date = $dates[0];
     $end_date = $dates[1];
     $first_day = mktime(0, 0, 0, date('m', $start_date), date('d', $start_date), date('Y', $start_date));
     $step = 86400 * 7;
     //1day
     $i = $first_day;
     $data = array();
     while ($i < $end_date + $step) {
         $this->select = 'sum(amount) as s';
         $deposited = $this->getLines(array('d'), 2, $i, $i + $step);
         $reinvested = $this->getLines(array('i'), 1, $i, $i + $step);
         $withrawn = $this->getLines(array('w'), 1, $i, $i + $step);
         $data[$i] = array($deposited[0]['s'] - abs($reinvested[0]['s']), abs($withrawn[0]['s']));
         $i += $step;
     }
     array_pop($data);
     $fp = fopen('stats.xml', 'w');
     $xml = "<chart>\n   \t\t<axis_category orientation='diagonal_up' size='10' step='1' />\n   \t\t<chart_type>\n   \t\t\t<string>line</string>\n   \t\t\t<string>line</string>\n   \t\t</chart_type>\n   \t\t<chart_grid_h alpha='10' thickness='1' />\n\t\t<chart_guide horizontal='true' vertical='true' thickness='1' alpha='25' type='dashed' text_h_alpha='0' text_v_alpha='0' />\n\t\t<chart_pref line_thickness='2' point_shape='circle' point_size='7' fill_shape='false' />\n\t\t<series_color>\n\t\t\t<color>ff4422</color>\n\t\t\t<color>00FF00</color>\n\t\t</series_color>\n\t\t<filter>\n\t\t\t<shadow id='medium' distance='2' angle='45' alpha='40' blurX='7' blurY='7' />\n\t\t\t<bevel id='note' angle='45' blurX='10' blurY='10' distance='3' highlightAlpha='60' shadowAlpha='15' />\n\t\t</filter>\n\t\t<chart_data><row><null/>";
     $xml .= '';
     foreach ($data as $key => $value) {
         $xml .= '<string>' . date('d.m.Y', $key) . '</string>';
     }
     $xml .= '</row><row><string>Deposits per day</string>';
     foreach ($data as $key => $value) {
         if (is_null($value[0])) {
             $value[0] = 0;
         }
         if (is_null($value[1]) || $value[1] == 0) {
             $value[1] = 1;
         }
         $xml .= '<number tooltip="$' . $value[0] . '" ' . ($value[0] > 0 ? 'note="' . number_format($value[0] / $value[1] * 100, 2) . '"' : '') . '>' . $value[0] . '</number>';
     }
     $xml .= '</row><row><string>Withdrawals per day</string>';
     foreach ($data as $key => $value) {
         if (is_null($value[1])) {
             $value[1] = 0;
         }
         $xml .= '<number tooltip="$' . $value[1] . '">' . $value[1] . '</number>';
     }
     $xml .= '</row>';
     $xml .= "</chart_data></chart>";
     fputs($fp, $xml);
     fclose($fp);
 }
开发者ID:andrii888,项目名称:VFXHYIP,代码行数:47,代码来源:statistics.class.php

示例14: old_mysql_result

 $classes = null;
 for ($c = 0; $c < $nb_classes; $c++) {
     $current_classe = old_mysql_result($get_classes, $c, "classe");
     $classes .= $current_classe;
     if ($c + 1 < $nb_classes) {
         $classes .= ", ";
     }
 }
 if ($nom_groupe == "-1") {
     $nom_groupe = "<font color='red'>Groupe inexistant</font>";
 }
 $sql_prof = sql_query("select nom, prenom from utilisateurs where login = '" . $id_prop . "'");
 if (!$sql_prof) {
     $nom_prof = "<font color='red'>" . $id_prop . " : utilisateur inexistant</font>";
 } else {
     $row_prof = sql_row($sql_prof, 0);
     $nom_prof = $row_prof[1] . " " . $row_prof[0];
     $test_groupe_prof = sql_query("select login from j_groupes_professeurs WHERE (id_groupe='" . $id_groupe . "' and login = '" . $id_prop . "')");
     if (sql_count($test_groupe_prof) == 0) {
         $nom_prof = "<font color='red'>" . $nom_prof . " : <br />Ce professeur n'enseigne pas dans ce groupe</font>";
     }
 }
 // Nombre de notices de chaque utilisateurs
 $nb_ct = sql_count(sql_query("select 1=1 FROM ct_entry WHERE (id_groupe='" . $id_groupe . "' and id_login='" . $id_prop . "' AND visa != 'y') "));
 // Nombre de notices devoirs de haque utilisateurs
 $nb_ct_devoirs = sql_count(sql_query("select 1=1 FROM ct_devoirs_entry WHERE (id_groupe='" . $id_groupe . "' and id_login='" . $id_prop . "') "));
 //Nombre de visa sur un cahier de texte
 $sql = "select 1=1 FROM ct_entry WHERE (id_groupe='" . $id_groupe . "' and id_login='" . $id_prop . "' and visa ='y');";
 $nb_ct_visa = sql_count(sql_query($sql));
 // Affichage des lignes
 echo "<tr class='lig{$alt} white_hover'><td>" . $classes . "</td>";
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:visa_ct.php

示例15: my_tab_docs_joints

function my_tab_docs_joints($id_ct, $type_notice)
{
    $tab_documents_joints = array();
    if ($type_notice == "t") {
        $sql = "SELECT titre, emplacement FROM ct_devoirs_documents WHERE id_ct_devoir='{$id_ct}' ORDER BY 'titre'";
    } else {
        if ($type_notice == "c") {
            $sql = "SELECT titre, emplacement FROM ct_documents WHERE id_ct='{$id_ct}' ORDER BY 'titre'";
        }
    }
    $res = sql_query($sql);
    if ($res and sql_count($res) != 0) {
        for ($i = 0; $row = sql_row($res, $i); $i++) {
            $titre = $row[0];
            $emplacement = $row[1];
            $tab_documents_joints[] = $emplacement;
        }
    }
    return $tab_documents_joints;
}
开发者ID:rhertzog,项目名称:lcs,代码行数:20,代码来源:cdt_lib.php


注:本文中的sql_row函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。