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


PHP pmb_mysql_field_name函数代码示例

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


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

示例1: parse

 /**
  * Parse les fichiers XML de parametres
  * il y a un fichier par type de tris
  */
 function parse()
 {
     global $include_path;
     global ${$params_name};
     global $charset;
     global $dbh;
     $params_name = $this->dSort->sortName . "_params";
     $params = ${$params_name};
     if ($params) {
         $this->params = $params;
     } else {
         $nomfichier = $include_path . "/sort/" . $this->dSort->sortName . "/sort.xml";
         if (file_exists($include_path . "/sort/" . $this->dSort->sortName . "/sort_subst.xml")) {
             $nomfichier = $include_path . "/sort/" . $this->dSort->sortName . "/sort_subst.xml";
             $fp = fopen($nomfichier, "r");
         } else {
             if (file_exists($nomfichier)) {
                 $fp = fopen($nomfichier, "r");
             }
         }
         if ($fp) {
             //un fichier est ouvert donc on le lit
             $xml = fread($fp, filesize($nomfichier));
             //on le ferme
             fclose($fp);
             //on le parse pour le transformer en tableau
             $params = _parser_text_no_function_($xml, "SORT");
             //on le stocke dans la classe
             $this->params = $params;
         } else {
             $this->error = true;
             $this->error_message = "Can't open definition file";
         }
     }
     //tri perso
     $p_perso = new parametres_perso("notices");
     foreach ($p_perso->t_fields as $key => $t_field) {
         if ($t_field['OPAC_SHOW'] && $t_field['OPAC_SORT']) {
             $param = _parser_text_no_function_("<?xml version='1.0' encoding='" . $charset . "'?>\n" . $t_field['OPTIONS'], "OPTIONS");
             switch ($t_field['TYPE']) {
                 case "comment":
                 case "text":
                     if ($param['REPETABLE'][0]['value']) {
                         $tablefield = "group_concat(" . $p_perso->prefix . "_custom_" . $t_field['DATATYPE'] . " separator ' ')";
                         $groupby = "group by notice_id";
                     } else {
                         $tablefield = $p_perso->prefix . "_custom_" . $t_field['DATATYPE'];
                         $groupby = "";
                     }
                     $p_tri = array('SOURCE' => "cp", 'TYPEFIELD' => "select", 'ID' => "cp" . $key, 'TYPE' => "text", 'NAME' => $t_field['NAME'], 'LABEL' => $t_field['TITRE'], 'TABLEFIELD' => array('value' => $tablefield), 'REQ_SUITE' => "left join " . $p_perso->prefix . "_custom_values on notices.notice_id = " . $p_perso->prefix . "_custom_values." . $p_perso->prefix . "_custom_origine where " . $p_perso->prefix . "_custom_values." . $p_perso->prefix . "_custom_champ = '" . $key . "' " . $groupby);
                     break;
                 case "list":
                     if ($param['MULTIPLE'][0]['value']) {
                         $tablefield = "group_concat(" . $p_perso->prefix . "_custom_list_lib separator ' ')";
                         $groupby = "group by notice_id";
                     } else {
                         $tablefield = $p_perso->prefix . "_custom_list_lib";
                         $groupby = "";
                     }
                     $p_tri = array('SOURCE' => "cp", 'TYPEFIELD' => "select", 'ID' => "cp" . $key, 'TYPE' => "text", 'NAME' => $t_field['NAME'], 'LABEL' => $t_field['TITRE'], 'TABLEFIELD' => array('value' => $tablefield), 'REQ_SUITE' => "left join " . $p_perso->prefix . "_custom_values on notices.notice_id = " . $p_perso->prefix . "_custom_values." . $p_perso->prefix . "_custom_origine \nleft join " . $p_perso->prefix . "_custom_lists on " . $p_perso->prefix . "_custom_" . $t_field['DATATYPE'] . " = " . $p_perso->prefix . "_custom_list_value \nwhere " . $p_perso->prefix . "_custom_lists." . $p_perso->prefix . "_custom_champ ='" . $key . "' and " . $p_perso->prefix . "_custom_values." . $p_perso->prefix . "_custom_champ ='" . $key . "'  " . $groupby);
                     break;
                 case "date_box":
                     $p_tri = array('SOURCE' => "cp", 'TYPEFIELD' => "select", 'ID' => "cp" . $key, 'TYPE' => "text", 'NAME' => $t_field['NAME'], 'LABEL' => $t_field['TITRE'], 'TABLEFIELD' => array('value' => $p_perso->prefix . "_custom_" . $t_field['DATATYPE']), 'REQ_SUITE' => "left join " . $p_perso->prefix . "_custom_values on notices.notice_id = " . $p_perso->prefix . "_custom_values." . $p_perso->prefix . "_custom_origine where " . $p_perso->prefix . "_custom_values." . $p_perso->prefix . "_custom_champ = '" . $key . "'");
                     break;
                 case "query_list":
                     $tableid = "";
                     $tablefield = "";
                     $tablename = "";
                     if ($param['MULTIPLE'][0]['value']) {
                         if ($param['QUERY'][0]['value']) {
                             $res = pmb_mysql_query($param['QUERY'][0]['value'], $dbh);
                             if ($res) {
                                 $tableid = pmb_mysql_field_name($res, 0);
                                 $tablefield = "group_concat(" . pmb_mysql_field_name($res, 1) . " separator ' ')";
                                 $tablename = pmb_mysql_field_table($res, 0);
                             }
                         }
                         $groupby = "group by notice_id";
                     } else {
                         if ($param['QUERY'][0]['value']) {
                             $res = pmb_mysql_query($param['QUERY'][0]['value'], $dbh);
                             if ($res) {
                                 $tableid = pmb_mysql_field_name($res, 0);
                                 $tablefield = pmb_mysql_field_name($res, 1);
                                 $tablename = pmb_mysql_field_table($res, 0);
                             }
                         }
                         $groupby = "";
                     }
                     $p_tri = array('SOURCE' => "cp", 'TYPEFIELD' => "select", 'ID' => "cp" . $key, 'TYPE' => "text", 'NAME' => $t_field['NAME'], 'LABEL' => $t_field['TITRE'], 'TABLEFIELD' => array('value' => $tablefield), 'REQ_SUITE' => "left join " . $p_perso->prefix . "_custom_values on notices.notice_id = " . $p_perso->prefix . "_custom_values." . $p_perso->prefix . "_custom_origine\nleft join " . $tablename . " on " . $p_perso->prefix . "_custom_" . $t_field['DATATYPE'] . " = " . $tableid . "\t\t\t\t\t\t \nwhere " . $p_perso->prefix . "_custom_values." . $p_perso->prefix . "_custom_champ ='" . $key . "' " . $groupby);
                     break;
                 default:
                     $p_tri = array();
                     break;
             }
             if ($p_tri) {
//.........这里部分代码省略.........
开发者ID:hogsim,项目名称:PMB,代码行数:101,代码来源:sort.class.php

示例2: show_results_stats


//.........这里部分代码省略.........
        $limite_mysql = $limite_page * $numero_page;
        //REINITIALISATION DE LA REQUETE SQL
        switch ($dest) {
            case "TABLEAU":
            case "TABLEAUHTML":
            case "TABLEAUCSV":
                if (!$req_nombre_lignes) {
                    $res = @pmb_mysql_query($sql, $dbh) or die($sql . "<br /><br />" . pmb_mysql_error());
                } else {
                    $res = $req_nombre_lignes;
                }
                break;
            default:
                echo "<h1>" . htmlentities($msg["opac_admin_menu"], ENT_QUOTES, $charset) . "&nbsp;:&nbsp;" . htmlentities($msg["stat_opac_menu"], ENT_QUOTES, $charset) . "</h1>";
                echo "<h1>" . htmlentities($row[1], ENT_QUOTES, $charset) . "</h1><h2>" . htmlentities($row[3], ENT_QUOTES, $charset) . "</h2>";
                $sql = $sql . " LIMIT " . $limite_mysql . ", " . $limite_page;
                // on execute la requete avec les bonnes limites
                $res = @pmb_mysql_query($sql, $dbh) or die($sql . "<br /><br />" . pmb_mysql_error());
                echo "<p>";
                break;
        }
        $nbr_lignes = @pmb_mysql_num_rows($res);
        $nbr_champs = @pmb_mysql_num_fields($res);
        if ($nbr_lignes) {
            switch ($dest) {
                case "TABLEAU":
                    $fichier_temp_nom = tempnam(sys_get_temp_dir(), $fichier_temp_nom);
                    $workbook = new writeexcel_workbook($fichier_temp_nom);
                    $worksheet =& $workbook->addworksheet();
                    $worksheet->write(0, 0, $row[1]);
                    $worksheet->write(0, 1, $row[3]);
                    for ($i = 0; $i < $nbr_champs; $i++) {
                        // entête de colonnes
                        $fieldname = pmb_mysql_field_name($res, $i);
                        $worksheet->write(2, $i, ${fieldname});
                    }
                    for ($i = 0; $i < $nbr_lignes; $i++) {
                        $row = pmb_mysql_fetch_row($res);
                        $j = 0;
                        foreach ($row as $dummykey => $col) {
                            if (is_numeric($col) && preg_match("/^0/", $col)) {
                                $col = "'" . $col;
                            }
                            if (trim($col) == '') {
                                $col = " ";
                            }
                            $worksheet->write($i + 3, $j, $col);
                            $j++;
                        }
                    }
                    $workbook->close();
                    $fh = fopen($fichier_temp_nom, "rb");
                    fpassthru($fh);
                    unlink($fichier_temp_nom);
                    break;
                case "TABLEAUHTML":
                    echo "<h1>{$row['1']}</h1><h2>{$row['3']}</h2>{$sql}<br/>";
                    echo "<table>";
                    for ($i = 0; $i < $nbr_champs; $i++) {
                        $fieldname = pmb_mysql_field_name($res, $i);
                        print "<th align='left'>{$fieldname}</th>";
                    }
                    for ($i = 0; $i < $nbr_lignes; $i++) {
                        $row = pmb_mysql_fetch_row($res);
                        echo "<tr>";
                        foreach ($row as $dummykey => $col) {
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:67,代码来源:stat_opac.inc.php

示例3: str_replace

         $tmpString = str_replace("!!group_expl_checkbox!!", '', $tmpString);
     }
 }
 foreach ($values_array as $values) {
     if ($nb % 2) {
         $tmpLigne = str_replace("!!class_ligne!!", "odd", $transferts_popup_ligne_tableau);
     } else {
         $tmpLigne = str_replace("!!class_ligne!!", "even", $transferts_popup_ligne_tableau);
     }
     //on parcourt toutes les colonnes de la requete
     for ($i = 0; $i < $nbCols; $i++) {
         //on remplace les données à afficher
         $tmpLigne = str_replace("!!" . pmb_mysql_field_name($res, $i) . "!!", $values[$i], $tmpLigne);
         if ($nb == 0 && $transferts_ghost_expl_enable) {
             $tmpStringGhost = str_replace("!!" . pmb_mysql_field_name($res, $i) . "!!", $values[$i], $tmpStringGhost);
             switch (pmb_mysql_field_name($res, $i)) {
                 case 'expl_id':
                     $tmpStringGhost = str_replace("!!expl_status!!", do_selector('docs_statut', "expl_virtual_status", $transferts_ghost_statut_expl_transferts), $tmpStringGhost);
                     $tmpStringGhost = str_replace("!!expl_parent_id!!", $values[$i], $tmpStringGhost);
                     break;
                 case 'expl_cb':
                     $tmpStringGhost = str_replace("!!cb_ghost_from!!", $values[$i], $tmpStringGhost);
                     break;
                 case 'expl_notice':
                     $tmpStringGhost = str_replace("!!parent_type!!", 'notice', $tmpStringGhost);
                     $tmpStringGhost = str_replace("!!parent_num!!", $values[$i], $tmpStringGhost);
                     break;
                 case 'expl_bulletin':
                     $tmpStringGhost = str_replace("!!parent_type!!", 'bulletin', $tmpStringGhost);
                     $tmpStringGhost = str_replace("!!parent_num!!", $values[$i], $tmpStringGhost);
                     break;
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:31,代码来源:transferts_popup.php

示例4: switch

    if ($empr_location_id != 0) {
        $sql .= "empr_location='{$empr_location_id}' AND ";
    }
    if ($docs_location_id != 0) {
        $sql .= "expl_location='{$docs_location_id}' AND ";
    }
}
$sql .= "expl_typdoc = idtyp_doc and pret_idexpl = expl_id  and empr.id_empr = pret.pret_idempr ";
$sql .= $critere_requete;
if ($nombre_lignes_pret > 0) {
    switch ($dest) {
        case "TABLEAU":
            $res = @pmb_mysql_query($sql, $dbh);
            $nbr_champs = @pmb_mysql_num_fields($res);
            for ($n = 0; $n < $nbr_champs; $n++) {
                $worksheet->write(2, $n, pmb_mysql_field_name($res, $n));
            }
            for ($i = 0; $i < $nombre_lignes_pret; $i++) {
                $row = pmb_mysql_fetch_row($res);
                $j = 0;
                foreach ($row as $dummykey => $col) {
                    if (!$col) {
                        $col = " ";
                    }
                    $worksheet->write($i + 3, $j, $col);
                    $j++;
                }
            }
            $workbook->close();
            $fh = fopen($fname, "rb");
            fpassthru($fh);
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:31,代码来源:expl.inc.php

示例5: while

 $num_tables = @pmb_mysql_num_rows($tables);
 $i = 0;
 while ($i < $num_tables) {
     $table[$i] = pmb_mysql_tablename($tables, $i);
     $i++;
 }
 echo "<table >";
 while (list($cle, $valeur) = each($table)) {
     $requete = $action . " TABLE " . $valeur . " ";
     $res = @pmb_mysql_query($requete, $dbh);
     $nbr_lignes = @pmb_mysql_num_rows($res);
     $nbr_champs = @pmb_mysql_num_fields($res);
     if ($nbr_lignes) {
         if (!$cle) {
             for ($i = 0; $i < $nbr_champs; $i++) {
                 printf("<th>%s</th>", pmb_mysql_field_name($res, $i));
             }
         }
         for ($i = 0; $i < $nbr_lignes; $i++) {
             $row = pmb_mysql_fetch_row($res);
             echo "<tr>";
             foreach ($row as $dummykey => $col) {
                 if (!$col) {
                     $col = "&nbsp;";
                 }
                 print "<td>{$col}</td>";
             }
             echo "</tr>";
         }
     }
 }
开发者ID:hogsim,项目名称:PMB,代码行数:31,代码来源:mysql.inc.php

示例6: startSession

function startSession($SESSNAME, $login, $database = LOCATION)
{
    global $dbh;
    // le lien MySQL
    global $stylesheet;
    /* pour qu'à l'ouverture de la session le user récupère de suite son style */
    global $PMBuserid, $PMBusername, $PMBgrp_num;
    global $checkuser_type_erreur;
    global $PMBusernom;
    global $PMBuserprenom;
    global $PMBuseremail;
    global $PMBdatabase;
    if (!$PMBdatabase) {
        $PMBdatabase = $database;
    }
    // nettoyage des sessions 'oubliées'
    cleanTable($SESSNAME);
    // génération d'un identificateur unique
    // initialisation du générateur de nombres aléatoires
    mt_srand((double) microtime() * 1000000);
    // nombre aléatoire entre 1111111111 et 9999999999
    $SESSID = mt_rand(1111111111, 9999999999);
    // début session (date UNIX)
    $SESSstart = time();
    // adresse IP du client
    $IP = $_SERVER['REMOTE_ADDR'];
    $query = "SELECT rights, user_lang FROM users WHERE username='{$login}'";
    $result = pmb_mysql_query($query, $dbh);
    $ff = pmb_mysql_fetch_object($result);
    $flag = $ff->rights;
    // inscription de la session dans la table
    $query = "INSERT INTO sessions (SESSID, login, IP, SESSstart, LastOn, SESSNAME) VALUES(";
    $query .= "'{$SESSID}'";
    $query .= ", '{$login}'";
    $query .= ", '{$IP}'";
    $query .= ", '{$SESSstart}'";
    $query .= ", '{$SESSstart}'";
    $query .= ", '{$SESSNAME}' )";
    $result = pmb_mysql_query($query, $dbh);
    if (!$result) {
        $checkuser_type_erreur = CHECK_USER_PB_OUVERTURE_SESSION;
        return CHECK_USER_PB_OUVERTURE_SESSION;
    }
    // cookie pour le login de l'utilisateur
    setcookie($SESSNAME . "-LOGIN", $login, 0);
    // cookie pour le nom de la session
    setcookie($SESSNAME . "-SESSNAME", $SESSNAME, 0);
    // cookie pour l'ID de session
    setcookie($SESSNAME . "-SESSID", $SESSID, 0);
    // cookie pour la base de donnée
    setcookie($SESSNAME . "-DATABASE", $PMBdatabase, 0);
    // mise à disposition des variables de la session
    define('SESSlogin', $login);
    define('SESSname', $SESSNAME);
    define('SESSid', $SESSID);
    define('SESSstart', $SESSstart);
    define('SESSlang', $ff->user_lang);
    define('SESSrights', $flag);
    /* param par défaut */
    $requete_param = "SELECT * FROM users WHERE username='{$login}' LIMIT 1 ";
    $res_param = pmb_mysql_query($requete_param, $dbh);
    $field_values = pmb_mysql_fetch_row($res_param);
    $i = 0;
    while ($i < pmb_mysql_num_fields($res_param)) {
        $field = pmb_mysql_field_name($res_param, $i);
        $field_deb = substr($field, 0, 6);
        switch ($field_deb) {
            case "deflt_":
                global ${$field};
                ${$field} = $field_values[$i];
                break;
            case "deflt2":
                global ${$field};
                ${$field} = $field_values[$i];
                break;
            case "param_":
                global ${$field};
                ${$field} = $field_values[$i];
                break;
            case "value_":
                global ${$field};
                ${$field} = $field_values[$i];
                break;
            case "xmlta_":
                global ${$field};
                ${$field} = $field_values[$i];
                break;
            case "deflt3":
                global ${$field};
                ${$field} = $field_values[$i];
                break;
            default:
                break;
        }
        $i++;
    }
    $requete_nom = "SELECT nom, prenom, user_email, userid, username, grp_num FROM users WHERE username='{$login}' ";
    $res_nom = pmb_mysql_query($requete_nom, $dbh);
    $param_nom = pmb_mysql_fetch_object($res_nom);
    $PMBusernom = $param_nom->nom;
//.........这里部分代码省略.........
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:101,代码来源:sessions.inc.php

示例7: extrait_info_notice

function extrait_info_notice($sql = "", $entete = 1, $flag = "")
{
    global $dbh;
    global $dest;
    global $worksheet;
    global $myCart;
    global $entete_bloc;
    global $msg;
    global $debligne_excel;
    global $etat_table;
    // permet de savoir si les tag table sont ouverts ou fermés
    global $max_aut;
    // le nombre max de colonnes d'auteurs
    global $thesaurus_mode_pmb;
    global $thesaurus_defaut;
    global $lang;
    global $pmb_keyword_sep;
    global $max_perso;
    global $res_compte3;
    if (!$debligne_excel) {
        $debligne_excel = 0;
    }
    $res = @pmb_mysql_query($sql, $dbh);
    $nbr_lignes = @pmb_mysql_num_rows($res);
    $nbr_champs = @pmb_mysql_num_fields($res);
    if ($nbr_lignes) {
        // Pour les champs personnalisés
        $caddie_type = $myCart->type;
        switch ($caddie_type) {
            case 'EXPL':
                $libelle_caddie_type = "expl";
                break;
            case 'NOTI':
            default:
                $libelle_caddie_type = "notices";
                break;
        }
        switch ($dest) {
            case "TABLEAU":
                if ($entete) {
                    $worksheet->write_string(1 + $debligne_excel, 0, $msg["caddie_mess_edition_" . $entete_bloc]);
                    $debligne_excel++;
                    $worksheet->write_string(1 + $debligne_excel, 0, $msg['caddie_action_marque']);
                    for ($i = 0; $i < $nbr_champs; $i++) {
                        // entête de colonnes
                        $fieldname = pmb_mysql_field_name($res, $i);
                        $worksheet->write_string(1 + $debligne_excel, $i + 1, $fieldname);
                    }
                    for ($i = 0; $i < $max_aut; $i++) {
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 1 + $nbr_champs, "aut_entree_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 2 + $nbr_champs, "aut_rejete_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 3 + $nbr_champs, "aut_dates_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 4 + $nbr_champs, "aut_fonction_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 5 + $nbr_champs, "aut_type_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 6 + $nbr_champs, "aut_resp_type_{$i}");
                    }
                    $worksheet->write_string(1 + $debligne_excel, $max_aut * 6 + $nbr_champs + 1, "DESCR");
                    for ($i = 0; $i < $max_perso; $i++) {
                        $perso = pmb_mysql_fetch_object($res_compte3);
                        $worksheet->write_string(1 + $debligne_excel, $max_aut * 6 + $nbr_champs + 2 + $i, $perso->titre);
                    }
                    $debligne_excel++;
                }
                //Fonctions d'auteurs
                $codes_auteurs = get_functions_authors();
                for ($i = 0; $i < $nbr_lignes; $i++) {
                    $debligne_excel++;
                    $row = pmb_mysql_fetch_row($res);
                    switch ($caddie_type) {
                        case 'EXPL':
                            $id_notice = $row[2];
                            break;
                        case 'NOTI':
                        default:
                            $id_notice = $row[0];
                            break;
                    }
                    if ($flag) {
                        $worksheet->write_string($debligne_excel, 0, "X");
                    }
                    $j = 0;
                    foreach ($row as $dummykey => $col) {
                        if (!$col) {
                            $col = " ";
                        }
                        $worksheet->write_string($debligne_excel, $j + 1, $col);
                        $j++;
                    }
                    $rqt_aut = "SELECT author_name, author_rejete, author_date, responsability_fonction, author_type, responsability_type ";
                    $rqt_aut .= "FROM responsability JOIN authors ON responsability_author=author_id ";
                    $rqt_aut .= "WHERE responsability_notice={$id_notice} ";
                    $rqt_aut .= "ORDER BY responsability_type ASC, responsability_ordre ASC";
                    $res_aut = @pmb_mysql_query($rqt_aut);
                    for ($iaut = 0; $iaut < $max_aut; $iaut++) {
                        $aut = @pmb_mysql_fetch_row($res_aut);
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 1 + $nbr_champs, $aut[0]);
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 2 + $nbr_champs, $aut[1]);
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 3 + $nbr_champs, $aut[2]);
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 4 + $nbr_champs, $codes_auteurs[$aut[3]]);
                        if ($aut[4] == "70") {
//.........这里部分代码省略.........
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:101,代码来源:edition_func.inc.php

示例8: error_message_history

 } else {
     echo "rqt=" . $valeur . "=<br />";
     error_message_history("Requête invalide", "Vous ne pouvez tester que des requêtes de sélection", 1);
     exit;
 }
 if (!explain_requete($valeur)) {
     die("<br /><br />" . $valeur . "<br /><br />" . $msg["proc_param_explain_failed"] . "<br /><br />" . $erreur_explain_rqt);
 }
 $res = @pmb_mysql_query($valeur, $dbh);
 $nbr_lignes = @pmb_mysql_num_rows($res);
 $nbr_champs = @pmb_mysql_num_fields($res);
 if ($nbr_lignes) {
     echo "<table >";
     for ($i = 0; $i < $nbr_champs; $i++) {
         // ajout de liens pour trier les pages
         $fieldname = pmb_mysql_field_name($res, $i);
         $sortasc = "<a href='{$urlbase}&sortfield=" . ($i + 1) . "&desc=0'>asc</a>";
         $sortdesc = "<a href='{$urlbase}&sortfield=" . ($i + 1) . "&desc=1'>desc</a>";
         print "<th>{$fieldname}</th>";
     }
     for ($i = 0; $i < $nbr_lignes; $i++) {
         $row = pmb_mysql_fetch_row($res);
         echo "<tr>";
         foreach ($row as $dummykey => $col) {
             if (!$col) {
                 $col = "&nbsp;";
             }
             print pmb_bidi("<td>{$col}</td>");
         }
         echo "</tr>";
     }
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:31,代码来源:execute.inc.php

示例9: desc_table

function desc_table($dbh, $table)
{
    $querry = "Select * from {$table}";
    $res = pmb_mysql_query($querry, $dbh);
    $nbr = pmb_mysql_num_fields($res);
    if ($nbr) {
        for ($j = 0; $j < $nbr; $j++) {
            $desc_table[$j][0] = pmb_mysql_field_name($res, $j);
            $desc_table[$j][1] = pmb_mysql_field_type($res, $j);
            $desc_table[$j][2] = pmb_mysql_field_len($res, $j);
            $desc_table[$j][3] = estNumerique($desc_table[$j][1], $desc_table[$j][2]);
            // j'ai seulement besoin de l'auto_increment, $desc_table[$j][4] est vrai si trouv?!
            $desc_table[$j][4] = array_search("auto_increment", explode(" ", pmb_mysql_field_flags($res, $j)));
        }
        //print_r($desc_table);
        return $desc_table;
    }
}
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:18,代码来源:import_empr.inc.php

示例10: affiche_liste_valide

function affiche_liste_valide($tpl_global, $tpl_ligne, $rqt_liste, $action)
{
    //on parcours tous les résultats de retours de la page de liste
    foreach ($_REQUEST as $k => $v) {
        //si c'est une case a cocher d'une liste
        if (substr($k, 0, 4) == "sel_" && $v == "1") {
            //le no de transfert
            $numeros .= substr($k, 4, strlen($k)) . ",";
        }
    }
    //on enleve la derniere virgule
    $numeros = substr($numeros, 0, strlen($numeros) - 1);
    //la requete pour récupérer les infos
    $rqt = str_replace("!!liste_numeros!!", $numeros, $rqt_liste);
    $res_rqt = pmb_mysql_query($rqt);
    //le nombre de colonnes dans la requete pour remplacer les champs dans le template
    $nbCols = pmb_mysql_num_fields($res_rqt);
    $nb = 0;
    //on parcours tous les enregistrements
    while ($values = pmb_mysql_fetch_array($res_rqt)) {
        //pour la coloration
        if ($nb % 2) {
            $tmpLigne = str_replace("!!class_ligne!!", "odd", $tpl_ligne);
        } else {
            $tmpLigne = str_replace("!!class_ligne!!", "even", $tpl_ligne);
        }
        //on parcours toutes les colonnes de la requete
        for ($i = 0; $i < $nbCols; $i++) {
            //on remplace les données à afficher
            $tmpLigne = aff_colonne($tmpLigne, pmb_mysql_field_name($res_rqt, $i), $values[$i]);
        }
        //affichage du titre
        $tmpLigne = str_replace("!!val_titre!!", aff_titre($values[0], $values[1]), $tmpLigne);
        //on ajoute la ligne aux autres
        $tmpString .= $tmpLigne;
        //le compteur pour la couleur
        $nb++;
    }
    $tmpString = str_replace("!!liste_transferts!!", $tmpString, $tpl_global);
    $tmpString = str_replace("!!liste_id!!", $numeros, $tmpString);
    $tmpString = str_replace("!!action_formulaire!!", $action, $tmpString);
    return $tmpString;
}
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:43,代码来源:affichage.inc.php

示例11: fetch_data

 function fetch_data()
 {
     global $dbh;
     //enumerate tables
     $res = pmb_mysql_list_tables(DATA_BASE);
     $i = 0;
     while ($i < pmb_mysql_num_rows($res)) {
         $update_a_faire = 0;
         /* permet de gérer les id auto_increment qui auraient pour valeur 0 */
         $table_name = pmb_mysql_tablename($res, $i);
         bzwrite($this->fptr, "delete from {$table_name};\n");
         $this->dump .= "delete from {$table_name};\n";
         //parse the field info first
         $res2 = pmb_mysql_query("select * from {$table_name} order by 1 ", $dbh);
         $nf = pmb_mysql_num_fields($res2);
         $nr = pmb_mysql_num_rows($res2);
         $fields = '';
         $values = '';
         for ($b = 0; $b < $nf; $b++) {
             $fn = pmb_mysql_field_name($res2, $b);
             $ft = pmb_mysql_field_type($res2, $b);
             $fs = pmb_mysql_field_len($res2, $b);
             $ff = pmb_mysql_field_flags($res2, $b);
             $is_numeric = false;
             switch (strtolower($ft)) {
                 case "int":
                     $is_numeric = true;
                     break;
                 case "blob":
                     $is_numeric = false;
                     break;
                 case "real":
                     $is_numeric = true;
                     break;
                 case "string":
                     $is_numeric = false;
                     break;
                 case "unknown":
                     switch (intval($fs)) {
                         case 4:
                             // little weakness here...
                             // there is no way (thru the PHP/MySQL interface)
                             // to tell the difference between a tinyint and a year field type
                             $is_numeric = true;
                             break;
                         default:
                             $is_numeric = true;
                             break;
                     }
                     break;
                 case "timestamp":
                     $is_numeric = true;
                     break;
                 case "date":
                     $is_numeric = false;
                     break;
                 case "datetime":
                     $is_numeric = false;
                     break;
                 case "time":
                     $is_numeric = false;
                     break;
                 default:
                     //future support for field types that are not recognized
                     //(hopefully this will work without need for future modification)
                     $is_numeric = true;
                     //I'm assuming new field types will follow SQL numeric syntax..
                     // this is where this support will breakdown
                     break;
             }
             $fields ? $fields .= ', ' . $fn : ($fields .= $fn);
             $fna[$b] = $fn;
             $ina[$b] = $is_numeric;
         }
         //parse out the table's data and generate the SQL INSERT statements in order to replicate the data itself...
         for ($c = 0; $c < $nr; $c++) {
             $row = pmb_mysql_fetch_row($res2);
             $values = '';
             for ($d = 0; $d < $nf; $d++) {
                 $data = strval($row[$d]);
                 if ($d == 0 && strval($row[$d]) == 0) {
                     /* traiter ici l'insertion avec valeur 1 pour id autoincrement et update à suivre */
                     $values ? $values .= ', ' . '1' : ($values .= '1');
                     $cle_update = pmb_mysql_field_name($res2, 0);
                     $update_a_faire = 1;
                 } else {
                     if ($ina[$d] == true) {
                         $values ? $values .= ', ' . intval($data) : ($values .= intval($data));
                     } else {
                         $values ? $values .= ", \"" . pmb_mysql_escape_string($data) . "\"" : ($values .= "\"" . pmb_mysql_escape_string($data) . "\"");
                     }
                 }
             }
             bzwrite($this->fptr, "insert into {$table_name} ({$fields}) values ({$values});\n");
             $this->dump .= "insert into {$table_name} ({$fields}) values ({$values});\n";
             if ($update_a_faire == 1) {
                 $update_a_faire = 0;
                 bzwrite($this->fptr, "update {$table_name} set " . $cle_update . "='0' where " . $cle_update . "='1';\n");
                 $this->dump .= "update {$table_name} set " . $cle_update . "='0' where " . $cle_update . "='1';\n";
             }
//.........这里部分代码省略.........
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:101,代码来源:mysql_backup.class.php

示例12: executeProc

 function executeProc($procedure, $idProc, $tparams)
 {
     global $msg, $dbh, $charset, $PMBuserid;
     global $pmb_procedure_server_credentials, $pmb_procedure_server_address;
     if (SESSrights & ADMINISTRATION_AUTH) {
         $name = '';
         $report = '';
         if ($tparams['envt']) {
             foreach ($tparams['envt'] as $aparam => $vparam) {
                 global ${$aparam};
                 ${$aparam} = $vparam;
             }
         }
         switch ($procedure) {
             case INTERNAL:
                 $hp = new parameters($idProc, 'procs');
                 $hp->get_final_query();
                 $code_sql = $hp->final_query;
                 $autorisations = $hp->proc->autorisations;
                 break;
             case EXTERNAL:
                 $pmb_procedure_server_credentials_exploded = explode("\n", $pmb_procedure_server_credentials);
                 if ($pmb_procedure_server_address && count($pmb_procedure_server_credentials_exploded) == 2) {
                     $aremote_procedure_client = new remote_procedure_client($pmb_procedure_server_address, trim($pmb_procedure_server_credentials_exploded[0]), trim($pmb_procedure_server_credentials_exploded[1]));
                     $procedure = $aremote_procedure_client->get_proc($idProc, "AP");
                     $the_procedure = $procedure['procedure'];
                     if ($procedure['error_message']) {
                         $report = htmlentities($msg['remote_procedures_error_server'], ENT_QUOTES, $charset) . ':<br /><i>' . $procedure['error_message'] . '</i>';
                         $result = array('name' => $the_procedure->name, 'report' => $report);
                         return $result;
                     } else {
                         if ($the_procedure->params && $the_procedure->params != 'NULL') {
                             $sql = 'CREATE TEMPORARY TABLE remote_proc LIKE procs';
                             pmb_mysql_query($sql, $dbh) or die(pmb_mysql_error());
                             $sql = "INSERT INTO remote_proc (idproc, name, requete, comment, autorisations, parameters, num_classement) VALUES (0, '" . pmb_mysql_escape_string($the_procedure->name) . "', '" . pmb_mysql_escape_string($the_procedure->sql) . "', '" . pmb_mysql_escape_string($the_procedure->comment) . "', '', '" . pmb_mysql_escape_string($the_procedure->params) . "', 0)";
                             pmb_mysql_query($sql, $dbh) or die(pmb_mysql_error());
                             $idproc = pmb_mysql_insert_id($dbh);
                             $hp = new parameters($idproc, 'remote_proc');
                             $hp->get_final_query();
                             $the_procedure->sql = $hp->final_query;
                             $name = $the_procedure->name;
                             $code_sql = $the_procedure->sql;
                             $commentaire = $the_procedure->comment;
                         }
                     }
                 }
                 break;
         }
         $linetemp = explode(';', $code_sql);
         if ($autorisations) {
             $temp_autorisation = explode(' ', $autorisations);
         }
         $allow = false;
         if ($temp_autorisation) {
             foreach ($temp_autorisation as $userid) {
                 if ($userid == $PMBuserid) {
                     $allow = true;
                 }
             }
             if (!$allow) {
                 $report = $msg[11];
                 //					throw new Exception($message, $code);
                 $result = array('name' => $name, 'report' => $report);
                 return $result;
             }
         }
         $line = array();
         for ($i = 0; $i < count($linetemp); $i++) {
             if (trim($linetemp[$i])) {
                 $line[] = trim($linetemp[$i]);
             }
         }
         while (list($cle, $valeur) = each($line)) {
             if ($valeur) {
                 $report .= "<strong>" . $msg['procs_ligne'] . " {$cle} </strong>:&nbsp;{$valeur}<br /><br />";
                 $er = explain_requete($valeur);
                 if ($er) {
                     $res = @pmb_mysql_query($valeur, $dbh);
                     $report .= pmb_mysql_error();
                     $nbr_lignes = @pmb_mysql_num_rows($res);
                     $nbr_champs = @pmb_mysql_num_fields($res);
                     if ($nbr_lignes) {
                         $report .= "<table >";
                         for ($i = 0; $i < $nbr_champs; $i++) {
                             $fieldname = pmb_mysql_field_name($res, $i);
                             $report .= "<th>{$fieldname}</th>";
                         }
                         for ($i = 0; $i < $nbr_lignes; $i++) {
                             $row = pmb_mysql_fetch_row($res);
                             $report .= "<tr>";
                             foreach ($row as $dummykey => $col) {
                                 if (trim($col) == '') {
                                     $col = '&nbsp;';
                                 }
                                 $report .= '<td >' . $col . '</td>';
                             }
                             $report .= "</tr>";
                         }
                         $report .= "</table><hr />";
                         $report .= "<font color='#ff0000'>" . $msg['admin_misc_lignes'] . " " . pmb_mysql_affected_rows($dbh) . "</font>";
//.........这里部分代码省略.........
开发者ID:hogsim,项目名称:PMB,代码行数:101,代码来源:pmbesProcs.class.php

示例13: table_dump

function table_dump($table_name, $fp)
{
    global $dbh;
    fwrite($fp, "#" . $table_name . "\r\n");
    fwrite($fp, "drop table if exists " . $table_name . ";\r\n");
    //Get strucutre
    fwrite($fp, create_statement($table_name) . "\n");
    //enumerate tables
    $update_a_faire = 0;
    /* permet de gérer les id auto_increment qui auraient pour valeur 0 */
    //parse the field info first
    $res2 = pmb_mysql_query("select * from {$table_name} order by 1 ", $dbh);
    if ($res2) {
        $nf = pmb_mysql_num_fields($res2);
        $nr = pmb_mysql_num_rows($res2);
    }
    $fields = '';
    $values = '';
    if ($nf) {
        for ($b = 0; $b < $nf; $b++) {
            $fn = pmb_mysql_field_name($res2, $b);
            $ft = pmb_mysql_field_type($res2, $b);
            $fs = pmb_mysql_field_len($res2, $b);
            $ff = pmb_mysql_field_flags($res2, $b);
            $is_numeric = false;
            switch (strtolower($ft)) {
                case "int":
                    $is_numeric = true;
                    break;
                case "blob":
                    $is_numeric = false;
                    break;
                case "real":
                    $is_numeric = true;
                    break;
                case "string":
                    $is_numeric = false;
                    break;
                case "unknown":
                    switch (intval($fs)) {
                        case 4:
                            // little weakness here...
                            // there is no way (thru the PHP/MySQL interface)
                            // to tell the difference between a tinyint and a year field type
                            $is_numeric = true;
                            break;
                        default:
                            $is_numeric = true;
                            break;
                    }
                    break;
                case "timestamp":
                    // Afin de résoudre le pb des timestamp pas corrects en restauration $is_numeric=true;
                    $is_numeric = false;
                    break;
                case "date":
                    $is_numeric = false;
                    break;
                case "datetime":
                    $is_numeric = false;
                    break;
                case "time":
                    $is_numeric = false;
                    break;
                case "geometry":
                    $is_numeric = false;
                    break;
                default:
                    //future support for field types that are not recognized
                    //(hopefully this will work without need for future modification)
                    $is_numeric = true;
                    //I'm assuming new field types will follow SQL numeric syntax..
                    // this is where this support will breakdown
                    break;
            }
            (string) $fields != "" ? $fields .= ', ' . $fn : ($fields .= $fn);
            $fna[$b] = $fn;
            $ina[$b] = $is_numeric;
        }
    }
    //parse out the table's data and generate the SQL INSERT statements in order to replicate the data itself...
    if ($nr) {
        for ($c = 0; $c < $nr; $c++) {
            $row = pmb_mysql_fetch_row($res2);
            $values = '';
            for ($d = 0; $d < $nf; $d++) {
                $data = strval($row[$d]);
                if ($ina[$d] == true) {
                    (string) $values != "" ? $values .= ', ' . floatval($data) : ($values .= floatval($data));
                } else {
                    (string) $values != "" ? $values .= ", \"" . pmb_mysql_real_escape_string($data) . "\"" : ($values .= "\"" . pmb_mysql_real_escape_string($data) . "\"");
                }
            }
            fwrite($fp, "insert into {$table_name} ({$fields}) values ({$values});\r\n");
            if ($update_a_faire == 1) {
                $update_a_faire = 0;
                fwrite($fp, "update {$table_name} set " . $cle_update . "='0' where " . $cle_update . "='1';\r\n");
            }
        }
    }
//.........这里部分代码省略.........
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:101,代码来源:api.inc.php

示例14: pmb_mysql_query

     // écriture de la méthode de création
     $dump_buffer .= "{$crlf}{$separator}# structure de la table {$valeur}{$crlf}{$separator}{$crlf}";
     $dump_buffer .= "DROP TABLE IF EXISTS " . $valeur . ";{$crlf}";
     $dump_buffer .= $create[1] . ";{$crlf}";
     $dump_buffer .= "{$crlf}{$separator}# contenu de la table {$valeur}{$crlf}{$separator}{$crlf}";
     // écriture des données
     $requete = "SELECT * FROM {$valeur}";
     $result = pmb_mysql_query($requete, $dbh);
     $nbr_lignes = pmb_mysql_num_rows($result);
     $field_set = "";
     $field = "";
     for ($i = 0; $i < $nbr_lignes; $i++) {
         $row = pmb_mysql_fetch_row($result);
         // on regarde si le champ est un entier
         for ($j = 0; $j < pmb_mysql_num_fields($result); $j++) {
             $field_set[$j] = pmb_mysql_field_name($result, $j);
             $type = pmb_mysql_field_type($result, $j);
             if ($type == 'tinyint' || $type == 'smallint' || $type == 'mediumint' || $type == 'int' || $type == 'bigint' || $type == 'timestamp') {
                 $field[$j] = $row[$j];
             } else {
                 $field[$j] = "'" . addslashes($row[$j]) . "'";
             }
         }
         $fields = implode(', ', $field_set);
         $content = implode(', ', $field);
         $dump_buffer .= "INSERT INTO " . $valeur . " ({$fields}) VALUES ({$content});{$crlf}";
     }
 }
 $file = "./tables/" . $file . ".sql";
 @set_time_limit(0);
 // timeout illimité
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:31,代码来源:backup.inc.php

示例15: pmb_mysql_num_fields

     break;
 default:
     //le nombre de colonnes dans la requete pour remplacer les champs dans le template
     $nbCols = pmb_mysql_num_fields($req);
     $tmpAff = "";
     //on boucle sur la liste
     while ($value = pmb_mysql_fetch_array($req)) {
         //pour la coloration
         if ($nb % 2) {
             $tmpLigne = str_replace("!!class_ligne!!", "odd", $tabLigne);
         } else {
             $tmpLigne = str_replace("!!class_ligne!!", "even", $tabLigne);
         }
         //on parcours toutes les colonnes de la requete
         for ($i = 0; $i < $nbCols; $i++) {
             $tmpLigne = str_replace("!!" . pmb_mysql_field_name($req, $i) . "!!", $value[$i], $tmpLigne);
         }
         //affichage du titre
         $tmpLigne = str_replace("!!val_titre!!", aff_titre($value[0], $value[1]), $tmpLigne);
         //on ajoute la ligne a la liste
         $tmpAff .= $tmpLigne;
         $nb++;
     }
     //fin while
     //on met les lignes du tableau dans le tableau
     $tmpAff = str_replace("!!lignes_tableau!!", $tmpAff, $transferts_edition_tableau);
     //si on a des colonnes en plus
     $tmpAff = str_replace("!!colonnes_variables!!", $cols_supp, $tmpAff);
     //la sub pour retomber sur ses pattes
     $tmpAff = str_replace("!!sub!!", $sub, $tmpAff);
     //les filtres
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:31,代码来源:transferts.inc.php


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