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


PHP Database::fetch_array方法代码示例

本文整理汇总了PHP中Database::fetch_array方法的典型用法代码示例。如果您正苦于以下问题:PHP Database::fetch_array方法的具体用法?PHP Database::fetch_array怎么用?PHP Database::fetch_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Database的用法示例。


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

示例1: ShowMenuFiche

function ShowMenuFiche($p_dossier)
{
    $cn = new Database($p_dossier);
    $mod = "&ac=" . $_REQUEST['ac'];
    $str_dossier = dossier::get() . $mod;
    echo '<div class="lmenu">';
    echo '<TABLE>';
    echo '<TR><TD colspan="1" class="mtitle"  style="width:auto" >
    <A class="mtitle" HREF="?p_action=fiche&action=add_modele&fiche=modele&' . $str_dossier . '">' . _('Création') . '</A></TD>
    <TD><A class="mtitle" HREF="?p_action=fiche&' . $str_dossier . '">' . _('Recherche') . '</A></TD>
    </TR>';
    $Res = $cn->exec_sql("select fd_id,fd_label from fiche_def order by fd_label");
    $Max = Database::num_row($Res);
    for ($i = 0; $i < $Max; $i++) {
        $l_line = Database::fetch_array($Res, $i);
        printf('<TR><TD class="cell">
               <A class="mtitle" HREF="?p_action=fiche&action=modifier&fiche=%d&%s">%s</A></TD>
               <TD class="mshort">
               <A class="mtitle" HREF="?p_action=fiche&action=vue&fiche=%d&%s">Liste</A>
               </TD>
               </TR>', $l_line['fd_id'], $str_dossier, $l_line['fd_label'], $l_line['fd_id'], $str_dossier);
    }
    echo "</TABLE>";
    echo '</div>';
}
开发者ID:Kloadut,项目名称:noalyss_ynh,代码行数:25,代码来源:user_menu.php

示例2: editAction

 /**
  * @Route("/edit/{tool}")
  * @Method({"GET"})
  *
  * @param string $tool
  * @return Response
  */
 public function editAction($tool)
 {
     $message = null;
     // @todo use proper functions not api functions.
     $courseId = api_get_course_int_id();
     $sessionId = api_get_session_id();
     $tool = \Database::escape_string($tool);
     $TBL_INTRODUCTION = \Database::get_course_table(TABLE_TOOL_INTRO);
     $url = $this->generateUrl('introduction.controller:editAction', array('tool' => $tool, 'course' => api_get_course_id()));
     $form = $this->getForm($url, $tool);
     if ($form->validate()) {
         $values = $form->exportValues();
         $content = $values['content'];
         $sql = "REPLACE {$TBL_INTRODUCTION}\n                    SET c_id = {$courseId},\n                        id = '{$tool}',\n                        intro_text='" . \Database::escape_string($content) . "',\n                        session_id='" . intval($sessionId) . "'";
         \Database::query($sql);
         $message = \Display::return_message(get_lang('IntroductionTextUpdated'), 'confirmation', false);
     } else {
         $sql = "SELECT intro_text FROM {$TBL_INTRODUCTION}\n                    WHERE c_id = {$courseId} AND id='" . $tool . "' AND session_id = '" . intval($sessionId) . "'";
         $result = \Database::query($sql);
         $content = null;
         if (\Database::num_rows($result) > 0) {
             $row = \Database::fetch_array($result);
             $content = $row['intro_text'];
         }
         $form->setDefaults(array('content' => $content));
     }
     $this->getTemplate()->assign('content', $form->return_form());
     $this->getTemplate()->assign('message', $message);
     $response = $this->getTemplate()->renderLayout('layout_1_col.tpl');
     return new Response($response, 200, array());
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:38,代码来源:IntroductionController.php

示例3: update_db_info

 /**
  * Update the file or directory path in the document db document table
  *
  * @author - Hugues Peeters <peeters@ipm.ucl.ac.be>
  * @param  - action (string) - action type require : 'delete' or 'update'
  * @param  - old_path (string) - old path info stored to change
  * @param  - new_path (string) - new path info to substitute
  * @desc Update the file or directory path in the document db document table
  *
  */
 static function update_db_info($action, $old_path, $new_path = '')
 {
     $dbTable = Database::get_course_table(TABLE_DOCUMENT);
     $course_id = api_get_course_int_id();
     /* DELETE */
     if ($action == 'delete') {
         $old_path = Database::escape_string($old_path);
         $to_delete = "WHERE c_id = {$course_id} AND path LIKE BINARY '" . $old_path . "' OR path LIKE BINARY '" . $old_path . "/%'";
         $query = "DELETE FROM {$dbTable} " . $to_delete;
         $result = Database::query("SELECT id FROM {$dbTable} " . $to_delete);
         if (Database::num_rows($result)) {
             require_once api_get_path(INCLUDE_PATH) . '../metadata/md_funcs.php';
             $mdStore = new mdstore(true);
             // create if needed
             $md_type = substr($dbTable, -13) == 'scormdocument' ? 'Scorm' : 'Document';
             while ($row = Database::fetch_array($result)) {
                 $eid = $md_type . '.' . $row['id'];
                 $mdStore->mds_delete($eid);
                 $mdStore->mds_delete_offspring($eid);
             }
         }
     }
     /* UPDATE */
     if ($action == 'update') {
         if ($new_path[0] == '.') {
             $new_path = substr($new_path, 1);
         }
         $new_path = str_replace('//', '/', $new_path);
         // Attempt to update	- tested & working for root	dir
         $new_path = Database::escape_string($new_path);
         $query = "UPDATE {$dbTable}\n            SET path = CONCAT('" . $new_path . "', SUBSTRING(path, LENGTH('" . $old_path . "')+1) )\n            WHERE c_id = {$course_id} AND path LIKE BINARY '" . $old_path . "' OR path LIKE BINARY '" . $old_path . "/%'";
     }
     Database::query($query);
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:44,代码来源:fileManager.lib.php

示例4: search_users

function search_users($needle, $type)
{
    global $_configuration, $tbl_access_url_rel_user, $tbl_user, $user_anonymous, $current_user_id, $user_id;
    $xajax_response = new XajaxResponse();
    $return = '';
    if (!empty($needle) && !empty($type)) {
        // xajax send utf8 datas... datas in db can be non-utf8 datas
        $charset = api_get_system_encoding();
        $needle = api_convert_encoding($needle, $charset, 'utf-8');
        $assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id);
        $assigned_users_id = array_keys($assigned_users_to_hrm);
        $without_assigned_users = '';
        if (count($assigned_users_id) > 0) {
            $without_assigned_users = " AND user.user_id NOT IN(" . implode(',', $assigned_users_id) . ")";
        }
        if ($_configuration['multiple_access_urls']) {
            $sql = "SELECT user.user_id, username, lastname, firstname FROM {$tbl_user} user LEFT JOIN {$tbl_access_url_rel_user} au ON (au.user_id = user.user_id)\n\t\t\tWHERE  " . (api_sort_by_first_name() ? 'firstname' : 'lastname') . " LIKE '{$needle}%' AND status NOT IN(" . DRH . ", " . SESSIONADMIN . ") AND user.user_id NOT IN ({$user_anonymous}, {$current_user_id}, {$user_id}) {$without_assigned_users} AND access_url_id = " . api_get_current_access_url_id() . "";
        } else {
            $sql = "SELECT user_id, username, lastname, firstname FROM {$tbl_user} user\n\t\t\tWHERE  " . (api_sort_by_first_name() ? 'firstname' : 'lastname') . " LIKE '{$needle}%' AND status NOT IN(" . DRH . ", " . SESSIONADMIN . ") AND user_id NOT IN ({$user_anonymous}, {$current_user_id}, {$user_id}) {$without_assigned_users}";
        }
        $rs = Database::query($sql);
        $return .= '<select id="origin" name="NoAssignedUsersList[]" multiple="multiple" size="20" style="width:340px;">';
        while ($user = Database::fetch_array($rs)) {
            $person_name = api_get_person_name($user['firstname'], $user['lastname']);
            $return .= '<option value="' . $user['user_id'] . '" title="' . htmlspecialchars($person_name, ENT_QUOTES) . '">' . $person_name . ' (' . $user['username'] . ')</option>';
        }
        $return .= '</select>';
        $xajax_response->addAssign('ajax_list_users_multiple', 'innerHTML', api_utf8_encode($return));
    }
    return $xajax_response;
}
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:dashboard_add_users_to_user.php

示例5: mdobject

 function mdobject($_course, $id)
 {
     global $ieee_dcmap_e, $ieee_dcmap_v;
     // md_funcs
     $scormdocument = Database::get_course_table(TABLE_LP_MAIN);
     $this->mdo_course = $_course;
     $this->mdo_type = 'Scorm';
     $this->mdo_id = $id;
     $this->mdo_eid = $this->mdo_type . '.' . $id;
     $this->mdo_dcmap_e = $ieee_dcmap_e;
     $this->mdo_dcmap_v = $ieee_dcmap_v;
     $sql = "SELECT path,description,lp_type FROM {$scormdocument} WHERE id='" . addslashes($id) . "'";
     if ($docinfo = @Database::fetch_array(Database::query($sql))) {
         $this->mdo_path = $docinfo['path'];
         //Sometimes the new scorm-tool adds '/.' at the end of a directory name, so remove this before continue
         //the process -- bmol
         if (substr($this->mdo_path, -2) == '/.') {
             $this->mdo_path = substr($this->mdo_path, 0, strlen($this->mdo_path) - 2);
         }
         $this->mdo_comment = $docinfo['description'];
         //Don't think the next line is correct. There used to be a 'type' field in the scormdocument table.
         //This metadata tool only works on folder types -- bmol
         $this->mdo_filetype = $docinfo['lp_type'] == 2 ? 'folder' : 'xxx';
         $this->mdo_url = get_course_web() . $this->mdo_course['path'] . '/scorm/' . $this->mdo_path . '/index.php';
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:26,代码来源:md_scorm.php

示例6: search_courses

 /**
  * Search for a list of available courses by title or code, based on
  * a given string
  * @param string String to search for
  * @param int Deprecated param
  * @return string A formatted, xajax answer block
  * @assert () === false
  */
 function search_courses($needle, $id)
 {
     global $tbl_course;
     $xajax_response = new XajaxResponse();
     $return = '';
     if (!empty($needle)) {
         // xajax send utf8 datas... datas in db can be non-utf8 datas
         $charset = api_get_system_encoding();
         $needle = api_convert_encoding($needle, $charset, 'utf-8');
         $needle = Database::escape_string($needle);
         // search courses where username or firstname or lastname begins likes $needle
         $sql = 'SELECT code, title FROM ' . $tbl_course . ' u ' . ' WHERE (title LIKE "' . $needle . '%" ' . ' OR code LIKE "' . $needle . '%" ' . ' ) ' . ' ORDER BY title, code ' . ' LIMIT 11';
         $rs = Database::query($sql);
         $i = 0;
         while ($course = Database::fetch_array($rs)) {
             $i++;
             if ($i <= 10) {
                 $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\'' . addslashes($course['code']) . '\',\'' . addslashes($course['title']) . ' (' . addslashes($course['code']) . ')' . '\')">' . $course['title'] . ' (' . $course['code'] . ')</a><br />';
             } else {
                 $return .= '...<br />';
             }
         }
     }
     $xajax_response->addAssign('ajax_list_courses', 'innerHTML', api_utf8_encode($return));
     return $xajax_response;
 }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:34,代码来源:access_url_edit_courses_to_url_functions.lib.php

示例7: __construct

 /**
  * Sets the surveylist and the plainsurveylist
  */
 public function __construct()
 {
     // Database table definitions
     $table_survey = Database::get_course_table(TABLE_SURVEY);
     $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
     $table_user = Database::get_main_table(TABLE_MAIN_USER);
     // searching
     $search_restriction = SurveyUtil::survey_search_restriction();
     if ($search_restriction) {
         $search_restriction = ' AND ' . $search_restriction;
     }
     $course_id = api_get_course_int_id();
     $sql = "SELECT\n                    survey.survey_id,\n                    survey.parent_id,\n                    survey_version,\n                    survey.code as name\n\t\t\t\tFROM {$table_survey} survey\n\t\t\t\tLEFT JOIN {$table_survey_question}  survey_question\n\t\t\t\tON survey.survey_id = survey_question.survey_id , {$table_user} user\n\t\t\t\tWHERE\n\t\t\t\t\tsurvey.c_id \t\t\t=  {$course_id} AND\n\t\t\t\t\tsurvey_question.c_id \t=  {$course_id} AND\n\t\t\t\t\tsurvey.author \t\t\t= user.user_id\n\t\t\t\tGROUP BY survey.survey_id";
     $res = Database::query($sql);
     $surveys_parents = array();
     $refs = array();
     $list = array();
     $plain_array = array();
     while ($survey = Database::fetch_array($res, 'ASSOC')) {
         $plain_array[$survey['survey_id']] = $survey;
         $surveys_parents[] = $survey['survey_version'];
         $thisref =& $refs[$survey['survey_id']];
         $thisref['parent_id'] = $survey['parent_id'];
         $thisref['name'] = $survey['name'];
         $thisref['id'] = $survey['survey_id'];
         $thisref['survey_version'] = $survey['survey_version'];
         if ($survey['parent_id'] == 0) {
             $list[$survey['survey_id']] =& $thisref;
         } else {
             $refs[$survey['parent_id']]['children'][$survey['survey_id']] =& $thisref;
         }
     }
     $this->surveylist = $list;
     $this->plainsurveylist = $plain_array;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:38,代码来源:surveymanager.lib.php

示例8: get_announcement_data

 public function get_announcement_data($username, $password, $course_code, $announcement_id, $field)
 {
     if ($this->verifyUserPass($username, $password) == "valid") {
         $htmlcode = false;
         $user_id = UserManager::get_user_id_from_username($username);
         $result = self::get_announcements($username, $course_code, $announcement_id);
         while ($announcement = Database::fetch_array($result)) {
             $announcements[] = $announcement;
         }
         switch ($field) {
             case 'sender':
                 $field_table = "insert_user_id";
                 $sender = api_get_user_info($announcements[0][$field_table]);
                 $announcements[0][$field_table] = $sender['firstname'] . " " . $sender['lastname'];
                 break;
             case 'title':
                 $htmlcode = true;
                 $field_table = "title";
                 break;
             case 'date':
                 $field_table = "end_date";
                 break;
             case 'content':
                 $htmlcode = true;
                 $field_table = "content";
                 $announcements[0][$field_table] = nl2br_revert($announcements[0][$field_table]);
                 break;
             default:
                 $field_table = "title";
         }
         return htmlcode ? html_entity_decode($announcements[0][$field_table]) : $announcements[0][$field_table];
     } else {
         return get_lang('InvalidId');
     }
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:35,代码来源:cm_webservice_announcements.php

示例9: search_courses

function search_courses($needle, $type)
{
    global $tbl_course, $tbl_course_rel_access_url, $user_id;
    $xajax_response = new xajaxResponse();
    $return = '';
    if (!empty($needle) && !empty($type)) {
        // xajax send utf8 datas... datas in db can be non-utf8 datas
        $needle = Database::escape_string($needle);
        $assigned_courses_to_hrm = CourseManager::get_courses_followed_by_drh($user_id);
        $assigned_courses_code = array_keys($assigned_courses_to_hrm);
        foreach ($assigned_courses_code as &$value) {
            $value = "'" . $value . "'";
        }
        $without_assigned_courses = '';
        if (count($assigned_courses_code) > 0) {
            $without_assigned_courses = " AND c.code NOT IN(" . implode(',', $assigned_courses_code) . ")";
        }
        if (api_is_multiple_url_enabled()) {
            $sql = "SELECT c.code, c.title\n                    FROM {$tbl_course} c\n\t\t\t\t\tLEFT JOIN {$tbl_course_rel_access_url} a\n                    ON (a.c_id = c.id)\n                \tWHERE\n                \t\tc.code LIKE '{$needle}%' {$without_assigned_courses} AND\n                \t\taccess_url_id = " . api_get_current_access_url_id();
        } else {
            $sql = "SELECT c.code, c.title\n            \t\tFROM {$tbl_course} c\n                \tWHERE\n                \t\tc.code LIKE '{$needle}%'\n                \t\t{$without_assigned_courses} ";
        }
        $rs = Database::query($sql);
        $return .= '<select id="origin" name="NoAssignedCoursesList[]" multiple="multiple" size="20" style="width:340px;">';
        while ($course = Database::fetch_array($rs)) {
            $return .= '<option value="' . $course['code'] . '" title="' . htmlspecialchars($course['title'], ENT_QUOTES) . '">' . $course['title'] . ' (' . $course['code'] . ')</option>';
        }
        $return .= '</select>';
        $xajax_response->addAssign('ajax_list_courses_multiple', 'innerHTML', api_utf8_encode($return));
    }
    return $xajax_response;
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:32,代码来源:dashboard_add_courses_to_user.php

示例10: search_sessions

function search_sessions($needle, $type)
{
    global $tbl_session_rel_access_url, $tbl_session, $user_id;
    $xajax_response = new xajaxResponse();
    $return = '';
    if (!empty($needle) && !empty($type)) {
        $needle = Database::escape_string($needle);
        $assigned_sessions_to_hrm = SessionManager::get_sessions_followed_by_drh($user_id);
        $assigned_sessions_id = array_keys($assigned_sessions_to_hrm);
        $without_assigned_sessions = '';
        if (count($assigned_sessions_id) > 0) {
            $without_assigned_sessions = " AND s.id NOT IN(" . implode(',', $assigned_sessions_id) . ")";
        }
        if (api_is_multiple_url_enabled()) {
            $sql = " SELECT s.id, s.name FROM {$tbl_session} s\n                        LEFT JOIN {$tbl_session_rel_access_url} a ON (s.id = a.session_id)\n                        WHERE  s.name LIKE '{$needle}%' {$without_assigned_sessions} AND access_url_id = " . api_get_current_access_url_id() . "";
        } else {
            $sql = "SELECT s.id, s.name FROM {$tbl_session} s\n                    WHERE  s.name LIKE '{$needle}%' {$without_assigned_sessions} ";
        }
        $rs = Database::query($sql);
        $return .= '<select class="form-control" id="origin" name="NoAssignedSessionsList[]" multiple="multiple" size="20">';
        while ($session = Database::fetch_array($rs)) {
            $return .= '<option value="' . $session['id'] . '" title="' . htmlspecialchars($session['name'], ENT_QUOTES) . '">' . $session['name'] . '</option>';
        }
        $return .= '</select>';
        $xajax_response->addAssign('ajax_list_sessions_multiple', 'innerHTML', api_utf8_encode($return));
    }
    return $xajax_response;
}
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:28,代码来源:dashboard_add_sessions_to_user.php

示例11: __construct

 public function __construct($in_c_id = 0, $in_id = 0)
 {
     if ($in_c_id > 0 && $in_id > 0) {
         $item_view_table = Database::get_course_table(TABLE_LP_ITEM);
         $sql = "SELECT * FROM {$item_view_table}\n                    WHERE\n                        c_id=" . intval($in_c_id) . " AND\n                        id=" . intval($in_id);
         $res = Database::query($sql);
         $data = Database::fetch_array($res);
         if (Database::num_rows($res) > 0) {
             $this->c_id = $data['c_id'];
             $this->id = $data['id'];
             $this->lp_id = $data['lp_id'];
             $this->item_type = $data['item_type'];
             $this->ref = $data['ref'];
             $this->title = $data['title'];
             $this->description = $data['description'];
             $this->path = $data['path'];
             $this->min_score = $data['min_score'];
             $this->max_score = $data['max_score'];
             $this->mastery_score = $data['mastery_score'];
             $this->parent_item_id = $data['parent_item_id'];
             $this->previous_item_id = $data['previous_item_id'];
             $this->next_item_id = $data['next_item_id'];
             $this->display_order = $data['display_order'];
             $this->prerequisite = $data['prerequisite'];
             $this->parameters = $data['parameters'];
             $this->launch_data = $data['launch_data'];
             $this->max_time_allowed = $data['max_time_allowed'];
             $this->terms = $data['terms'];
             $this->search_did = $data['search_did'];
             $this->audio = $data['audio'];
         }
     }
 }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:33,代码来源:lp_item.lib.php

示例12: search_users

 /**
  * Search users by username, firstname or lastname, based on the given
  * search string
  * @param string Search string
  * @param int Deprecated param
  * @return string Xajax response block
  * @assert () === false
  */
 public static function search_users($needle, $id)
 {
     global $tbl_user, $tbl_access_url_rel_user;
     $xajax_response = new XajaxResponse();
     $return = '';
     if (!empty($needle)) {
         // xajax send utf8 datas... datas in db can be non-utf8 datas
         $charset = api_get_system_encoding();
         $needle = api_convert_encoding($needle, $charset, 'utf-8');
         $needle = Database::escape_string($needle);
         // search users where username or firstname or lastname begins likes $needle
         $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
         $sql = 'SELECT u.user_id, username, lastname, firstname FROM ' . $tbl_user . ' u ' . ' WHERE (username LIKE "' . $needle . '%" ' . ' OR firstname LIKE "' . $needle . '%" ' . ' OR lastname LIKE "' . $needle . '%") ' . $order_clause . ' LIMIT 11';
         $rs = Database::query($sql);
         $i = 0;
         while ($user = Database::fetch_array($rs)) {
             $i++;
             if ($i <= 10) {
                 $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\'' . addslashes($user['user_id']) . '\',\'' . api_get_person_name(addslashes($user['firstname']), addslashes($user['lastname'])) . ' (' . addslashes($user['username']) . ')' . '\')">' . api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ')</a><br />';
             } else {
                 $return .= '...<br />';
             }
         }
     }
     $xajax_response->addAssign('ajax_list_users', 'innerHTML', api_utf8_encode($return));
     return $xajax_response;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:35,代码来源:access_url_edit_users_to_url_functions.lib.php

示例13: getPriceChanges

 public function getPriceChanges()
 {
     if (isset($this->sc_id)) {
         $database = new Database();
         $datbase = new Database();
         $query = "SELECT id,cur_val,date_t FROM " . self::$table;
         $query .= " WHERE sc_id = " . $this->sc_id;
         $query .= " ORDER BY id DESC";
         $amt_chg_wrp = $database->query($query);
         if ($amt_chg_wrp) {
             $flag = 0;
             while ($p_change = $datbase->fetch_array($amt_chg_wrp)) {
                 //Updating the current amount
                 if ($flag === 0) {
                     $this->cur_amt = $p_change['cur_val'];
                     $flag++;
                 }
                 $this->priceChanges[] = array($p_change['cur_val'], $p_change['date_t']);
                 unset($database);
             }
         } else {
             $this->priceChanges[] = 0;
             unset($database);
         }
     }
 }
开发者ID:ciplpj,项目名称:vsm,代码行数:26,代码来源:Stock.class.php

示例14: search_sessions

function search_sessions($needle, $type)
{
    global $_configuration, $tbl_session_rel_access_url, $tbl_session, $user_id;
    $xajax_response = new XajaxResponse();
    $return = '';
    if (!empty($needle) && !empty($type)) {
        // xajax send utf8 datas... datas in db can be non-utf8 datas
        $charset = api_get_system_encoding();
        $needle = api_convert_encoding($needle, $charset, 'utf-8');
        $assigned_sessions_to_hrm = SessionManager::get_sessions_followed_by_drh($user_id);
        $assigned_sessions_id = array_keys($assigned_sessions_to_hrm);
        $without_assigned_sessions = '';
        if (count($assigned_sessions_id) > 0) {
            $without_assigned_sessions = " AND s.id NOT IN(" . implode(',', $assigned_sessions_id) . ")";
        }
        if ($_configuration['multiple_access_urls']) {
            $sql = " SELECT s.id, s.name FROM {$tbl_session} s LEFT JOIN {$tbl_session_rel_access_url} a ON (s.id = a.session_id)\n\t\t\t\t\t\tWHERE  s.name LIKE '{$needle}%' {$without_assigned_sessions} AND access_url_id = " . api_get_current_access_url_id() . "";
        } else {
            $sql = "SELECT s.id, s.name FROM {$tbl_session} s\n\t\t\t\tWHERE  s.name LIKE '{$needle}%' {$without_assigned_sessions} ";
        }
        $rs = Database::query($sql);
        $return .= '<select id="origin" name="NoAssignedSessionsList[]" multiple="multiple" size="20" style="width:340px;">';
        while ($session = Database::fetch_array($rs)) {
            $return .= '<option value="' . $session['id'] . '" title="' . htmlspecialchars($session['name'], ENT_QUOTES) . '">' . $session['name'] . '</option>';
        }
        $return .= '</select>';
        $xajax_response->addAssign('ajax_list_sessions_multiple', 'innerHTML', api_utf8_encode($return));
    }
    return $xajax_response;
}
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:30,代码来源:dashboard_add_sessions_to_user.php

示例15: checkLogin

function checkLogin($login, $pass)
{
    $db = new Database();
    //Traigo el usuario
    $q = "select salt from jugador where login='{$login}' limit 1";
    $r = $db->query($q);
    //Controlo que exista el usuario con el login $login
    if ($db->num_rows($r) > 0) {
        //Traigo el registro
        $data = $db->fetch_array($r);
        $salt_db = $data['salt'];
        //Genero el mismo hash que se creo al registrar jugador
        $hashedpass = hash('sha512', $pass . $salt_db);
        $q2 = "select * from jugador where login='{$login}' and pass=PASSWORD('{$hashedpass}')";
        $r2 = $db->query($q2);
        if ($db->num_rows($r2) > 0) {
            return 1;
        } else {
            return 0;
        }
    } else {
        alertMessage('El usuario no existe');
        exit;
    }
    $db->close();
}
开发者ID:brunitosessa,项目名称:armaelequipo,代码行数:26,代码来源:login.php


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