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


PHP MySQL::SelectRows方法代码示例

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


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

示例1: admin_cp_login

/** Đăng nhập admin cp */
function admin_cp_login()
{
    global $hmuser;
    $hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
    hook_action('admin_cp_login');
    $user_login = hm_post('login');
    $password = hm_post('password');
    $logmein = hm_post('log-me-in');
    if (is_numeric($logmein)) {
        $tableName = DB_PREFIX . "users";
        $whereArray = array('user_login' => MySQL::SQLValue($user_login));
        $hmdb->SelectRows($tableName, $whereArray);
        if ($hmdb->HasRecords()) {
            $row = $hmdb->Row();
            $salt = $row->salt;
            $user_pass = $row->user_pass;
            $password_encode = hm_encode_str(md5($password . $salt));
            if ($password_encode == $user_pass) {
                $time = time();
                $ip = hm_ip();
                $cookie_array = array('time' => $time, 'ip' => $ip, 'user_login' => $user_login, 'admincp' => 'yes');
                $cookie_user = hm_encode_str($cookie_array);
                setcookie('admin_login', $cookie_user, time() + COOKIE_EXPIRES, '/');
                $_SESSION['admin_login'] = $cookie_user;
                return json_encode(array('status' => 'success', 'mes' => _('Đăng nhập thành công')));
            } else {
                return json_encode(array('status' => 'error', 'mes' => _('Sai mật khẩu')));
            }
        } else {
            return json_encode(array('status' => 'error', 'mes' => _('Không có tài khoản này')));
        }
    }
}
开发者ID:butkimtinh,项目名称:hoamai-cms-beta-1.0,代码行数:34,代码来源:login_model.php

示例2: get_uri_data

        return FALSE;
    }
}
function get_uri_data($args)
{
    $hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
    if (!is_array($args)) {
        parse_str($args, $args);
    }
    if (isset($args['uri'])) {
        $uri = $args['uri'];
    } else {
        $uri = FALSE;
    }
    if (isset($args['id'])) {
        $id_uri = $args['id'];
    } else {
        $id_uri = FALSE;
    }
    $tableName = DB_PREFIX . "request_uri";
    if (is_numeric($id_uri)) {
        $whereArray = array('id' => MySQL::SQLValue($id_uri));
    } else {
        $whereArray = array('uri' => MySQL::SQLValue($uri));
    }
    $hmdb->SelectRows($tableName, $whereArray);
    if ($hmdb->HasRecords()) {
        $row = $hmdb->Row();
        return $row;
    } else {
开发者ID:butkimtinh,项目名称:hoamai-cms-beta-1.0,代码行数:30,代码来源:routing.php

示例3: rowExists

 /**
  * checks if a given db row based on the $idColumn & $id exists
  * @param string $table
  * @param array $filter
  * @return bool
  */
 protected function rowExists($table, array $filter)
 {
     $select = $this->conn->SelectRows($table, $filter);
     if (!$select) {
         $this->logLastError('rowExists');
         return false;
     }
     return (bool) $this->conn->RowArray(0, MYSQLI_ASSOC);
 }
开发者ID:kimai,项目名称:kimai,代码行数:15,代码来源:Mysql.php

示例4: get_media_group_part

/** Lấy đường dẫn nhóm media */
function get_media_group_part($id = 0, $i = 1, $deepest = FALSE)
{
    $hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
    if (!is_numeric($id)) {
        $tableName = DB_PREFIX . 'media_groups';
        $whereArray = array('folder' => MySQL::SQLValue($id));
        $hmdb->SelectRows($tableName, $whereArray);
        $row = $hmdb->Row();
        $id = $row->id;
    }
    $bre = array();
    $sub_bre = FALSE;
    if ($deepest == FALSE) {
        $deepest = $id;
    }
    $tableName = DB_PREFIX . 'media_groups';
    $whereArray = array('id' => MySQL::SQLValue($id));
    $hmdb->SelectRows($tableName, $whereArray);
    $row = $hmdb->Row();
    $num_rows = $hmdb->RowCount();
    if ($num_rows != 0) {
        $this_id = $row->id;
        $folder = $row->folder;
        $parent = $row->parent;
        $bre['level_' . $i] = $folder;
        if ($parent != '0') {
            $inew = $i + 1;
            $sub_bre = get_media_group_part($parent, $inew, $deepest);
        }
    }
    if (is_array($sub_bre)) {
        $bre = array_merge($bre, $sub_bre);
    }
    krsort($bre);
    $part = implode("/", $bre);
    if ($deepest == $id) {
        return $part;
    } else {
        return $bre;
    }
}
开发者ID:butkimtinh,项目名称:hoamai-cms-beta-1.0,代码行数:42,代码来源:media.php

示例5: list_plugin

function list_plugin($active = 1)
{
    $hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
    $tableName = DB_PREFIX . "plugin";
    $whereArray = array('active' => MySQL::SQLValue($active, MySQL::SQLVALUE_NUMBER));
    $hmdb->SelectRows($tableName, $whereArray);
    if ($hmdb->HasRecords()) {
        while ($row = $hmdb->Row()) {
            $return[] = $row->key;
        }
        return json_encode($return);
    } else {
        return array();
    }
}
开发者ID:butkimtinh,项目名称:hoamai-cms-beta-1.0,代码行数:15,代码来源:plugin_model.php

示例6: is_theme_active

function is_theme_active($theme)
{
    $hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
    if (is_dir(BASEPATH . HM_THEME_DIR . '/' . $theme) and is_file(BASEPATH . HM_THEME_DIR . '/' . $theme . '/init.php')) {
        $tableName = DB_PREFIX . "option";
        $whereArray = array('section' => MySQL::SQLValue('system_setting'), 'key' => MySQL::SQLValue('theme'), 'value' => MySQL::SQLValue($theme));
        $hmdb->SelectRows($tableName, $whereArray);
        if ($hmdb->HasRecords()) {
            return TRUE;
        } else {
            return FALSE;
        }
    } else {
        return FALSE;
    }
}
开发者ID:butkimtinh,项目名称:hoamai-cms-beta-1.0,代码行数:16,代码来源:theme_model.php

示例7: menu_select_choise

    $array = array('id' => $id, 'status' => TRUE);
    return json_encode($array);
}
function menu_select_choise($args = array())
{
    if (!is_array($args)) {
        parse_str($args, $args);
    }
    hook_action('menu_select_choise');
    if (isset($args['checked'])) {
        $checked = $args['checked'];
    } else {
        $checked = 0;
    }
    if (isset($args['name'])) {
        $name = $args['name'];
    } else {
        $name = 'menu';
    }
    $hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
    $tableName = DB_PREFIX . "object";
    $whereArray = array('key' => MySQL::SQLValue('menu'));
    $hmdb->SelectRows($tableName, $whereArray);
    $rowCount = $hmdb->RowCount();
    if (is_numeric($rowCount)) {
        $options[] = array('value' => '0', 'label' => 'Chọn một trình đơn');
        while ($row = $hmdb->Row()) {
            $options[] = array('value' => $row->id, 'label' => $row->name);
        }
        $field_array['input_type'] = 'select';
        $field_array['name'] = $name;
        $field_array['input_option'] = $options;
        $field_array['default_value'] = $checked;
        $field_array['addClass'] = 'choise_menu';
开发者ID:butkimtinh,项目名称:hoamai-cms-beta-1.0,代码行数:34,代码来源:menu_model.php

示例8: MySQL

<?php

include "Mysql.php";
echo "<hr>";
try {
    $filter["ALUNO_NOME"] = MySQL::SQLValue('%');
    $db = new MySQL();
    if (!$db) {
        echo " bd não instanciado! <br><br>";
    } else {
        echo " bd instanciado.<br><br>";
    }
    $db->SelectRows("ALUNO");
    if ($db->RowCount() > 0) {
        echo "Conectado.<br><br><hr>";
    }
    echo "<br>Tabela: aluno <p>";
    echo $db->GetHTML();
    echo '<br><br>';
    $db->Close();
} catch (Exception $e) {
    echo "Erro: ", $e->getMessage(), "\n";
}
echo "<hr>";
try {
    //$filter["ALUNO_NOME"] = MySQL::SQLValue('%');
    //exibir tabela MATERIA
    echo "Tabela: materia <p>";
    $db->SelectRows("MATERIA");
    echo $db->GetHTML();
    echo '<br><br>';
开发者ID:marcosyyz,项目名称:self,代码行数:31,代码来源:testeconexao.php

示例9: admin_cp_newpw

function admin_cp_newpw()
{
    global $hmuser;
    $hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
    hook_action('newpw_checkkey');
    $key = hm_post('key');
    $password = hm_post('password');
    $password2 = hm_post('password2');
    if ($password == $password2) {
        $tableName = DB_PREFIX . "field";
        $whereArray = array('name' => MySQL::SQLValue('lostpw_key'), 'object_type' => MySQL::SQLValue('user'), 'val' => MySQL::SQLValue($key));
        $hmdb->SelectRows($tableName, $whereArray);
        $row = $hmdb->Row();
        $user_id = $row->object_id;
        $salt = rand(100000, 999999);
        $password_encode = hm_encode_str(md5($password . $salt));
        $tableName = DB_PREFIX . "users";
        $updateArray = array('user_pass' => MySQL::SQLValue($password_encode), 'salt' => MySQL::SQLValue($salt));
        $whereArray = array('id' => MySQL::SQLValue($user_id, MySQL::SQLVALUE_NUMBER));
        $hmdb->UpdateRows($tableName, $updateArray, $whereArray);
        return json_encode(array('status' => 'success', 'mes' => _('Đã đổi mật khẩu thành công')));
    } else {
        return json_encode(array('status' => 'error', 'mes' => _('Hai mật khẩu bạn nhập vào không khớp')));
    }
}
开发者ID:hoamaisoft,项目名称:hoamai-cms-beta-1.0,代码行数:25,代码来源:login_model.php

示例10: ajax_add_user

/** Load template user box */
function ajax_add_user($args = array())
{
    global $hmuser;
    $hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
    hook_action('ajax_add_user');
    if (isset($args['id_update'])) {
        $id_update = $args['id_update'];
    } else {
        $id_update = NULL;
    }
    $user_login = hm_post('user_login');
    $password = hm_post('password');
    $password2 = hm_post('password2');
    $nicename = hm_post('nicename');
    $user_email = hm_post('user_email');
    $userrole = hm_post('userrole');
    $user_group = hm_post('user_group', 0);
    $salt = rand(100000, 999999);
    $user_activation_key = '0';
    if ($password != $password2) {
        return json_encode(array('status' => 'error', 'mes' => _('Hai mật khẩu nhập vào không khớp')));
        hm_exit();
    }
    $tableName = DB_PREFIX . "users";
    /** check trùng user login */
    if (!is_numeric($id_update)) {
        $whereArray = array('user_login' => MySQL::SQLValue($user_login));
        $hmdb->SelectRows($tableName, $whereArray);
        if ($hmdb->HasRecords()) {
            return json_encode(array('status' => 'error', 'mes' => _('Tài khoản này đã tồn tại')));
            hm_exit();
        }
    }
    $password_encode = hm_encode_str(md5($password . $salt));
    /** Thêm tài khoản */
    $values["user_login"] = MySQL::SQLValue($user_login);
    $values["user_nicename"] = MySQL::SQLValue($nicename);
    $values["user_email"] = MySQL::SQLValue($user_email);
    $values["user_activation_key"] = MySQL::SQLValue($user_activation_key);
    $values["user_role"] = MySQL::SQLValue($userrole);
    $values["user_group"] = MySQL::SQLValue($user_group);
    if (is_numeric($id_update)) {
        if ($password != '') {
            $values["user_pass"] = MySQL::SQLValue($password_encode);
            $values["salt"] = MySQL::SQLValue($salt);
        }
        $whereArray = array('id' => $id_update);
        $hmdb->AutoInsertUpdate($tableName, $values, $whereArray);
        $insert_id = $id_update;
    } else {
        $values["user_pass"] = MySQL::SQLValue($password_encode);
        $values["salt"] = MySQL::SQLValue($salt);
        $insert_id = $hmdb->InsertRow($tableName, $values);
    }
    /** Lưu user field */
    foreach ($_POST as $post_key => $post_val) {
        if (is_numeric($insert_id)) {
            if (is_array($post_val)) {
                $post_val = json_encode($post_val);
            }
            $tableName = DB_PREFIX . 'field';
            if ($post_key != 'password' and $post_key != 'password2') {
                $values["name"] = MySQL::SQLValue($post_key);
                $values["val"] = MySQL::SQLValue($post_val);
                $values["object_id"] = MySQL::SQLValue($insert_id, MySQL::SQLVALUE_NUMBER);
                $values["object_type"] = MySQL::SQLValue('user');
                if (is_numeric($id_update)) {
                    $whereArray = array('object_id' => MySQL::SQLValue($id_update, MySQL::SQLVALUE_NUMBER), 'object_type' => MySQL::SQLValue('user'), 'name' => MySQL::SQLValue($post_key));
                    $hmdb->AutoInsertUpdate($tableName, $values, $whereArray);
                } else {
                    $hmdb->InsertRow($tableName, $values);
                }
            }
            unset($values);
        }
    }
    if (is_numeric($id_update)) {
        return json_encode(array('status' => 'updated', 'mes' => _('Đã sửa thông tin tài khoản : ' . $user_login)));
    } else {
        return json_encode(array('status' => 'success', 'mes' => _('Đã thêm tài khoản : ' . $user_login)));
    }
}
开发者ID:hoamaisoft,项目名称:hoamai-cms-beta-1.0,代码行数:83,代码来源:user_model.php

示例11: content_delete_permanently

function content_delete_permanently($id)
{
    $hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
    hook_action('content_delete_permanently');
    if (is_numeric($id)) {
        /* xóa bảng content */
        $tableName = DB_PREFIX . "content";
        $whereArray = array('id' => MySQL::SQLValue($id));
        $hmdb->DeleteRows($tableName, $whereArray);
        /** Tìm các sub content */
        $whereArray = array('parent' => MySQL::SQLValue($id));
        $hmdb->SelectRows($tableName, $whereArray);
        $ids = array();
        while ($row = $hmdb->Row()) {
            $ids[] = $row->id;
        }
        foreach ($ids as $delete_id) {
            /** xóa các sub content */
            $tableName = DB_PREFIX . "content";
            $whereArray = array('id' => MySQL::SQLValue($delete_id));
            $hmdb->DeleteRows($tableName, $whereArray);
            /** xóa các sub content field */
            $tableName = DB_PREFIX . "field";
            $whereArray = array('object_id' => MySQL::SQLValue($delete_id), 'object_type' => MySQL::SQLValue('content'));
            $hmdb->DeleteRows($tableName, $whereArray);
            /* xóa các relationship */
            $tableName = DB_PREFIX . "relationship";
            $whereArray = array('object_id' => MySQL::SQLValue($delete_id));
            $hmdb->DeleteRows($tableName, $whereArray);
            /** xóa các sub request */
            $tableName = DB_PREFIX . "request_uri";
            $whereArray = array('object_id' => MySQL::SQLValue($delete_id));
            $hmdb->DeleteRows($tableName, $whereArray);
        }
        /* xóa bảng field */
        $tableName = DB_PREFIX . "field";
        $whereArray = array('object_id' => MySQL::SQLValue($id), 'object_type' => MySQL::SQLValue('content'));
        $hmdb->DeleteRows($tableName, $whereArray);
        /* xóa bảng relationship */
        $tableName = DB_PREFIX . "relationship";
        $whereArray = array('object_id' => MySQL::SQLValue($id));
        $hmdb->DeleteRows($tableName, $whereArray);
        /* xóa bảng request uri */
        $tableName = DB_PREFIX . "request_uri";
        $whereArray = array('object_id' => MySQL::SQLValue($id), 'object_type' => MySQL::SQLValue('content'));
        $hmdb->DeleteRows($tableName, $whereArray);
    }
}
开发者ID:butkimtinh,项目名称:hoamai-cms-beta-1.0,代码行数:48,代码来源:content_model.php

示例12: taxonomy_checkbox_list

function taxonomy_checkbox_list($args = array())
{
    hook_action('taxonomy_checkbox_list');
    hook_filter('taxonomy_checkbox_list_before', $args);
    global $hmtaxonomy;
    $hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
    @($key = $args['key']);
    @($parent = $args['parent'] ? $args['parent'] : 0);
    @($default_value = $args['default_value']);
    @($object_id = $args['object_id']);
    if (is_numeric($object_id)) {
        $tableName = DB_PREFIX . "relationship";
        $whereArray = array('object_id' => MySQL::SQLValue($object_id), 'relationship' => MySQL::SQLValue('contax'));
        $hmdb->SelectRows($tableName, $whereArray);
        while ($row = $hmdb->Row()) {
            $default_value[] = $row->target_id;
        }
    }
    if (!is_array($default_value)) {
        $default_value = array();
    }
    $tax = $hmtaxonomy->hmtaxonomy;
    if (isset($tax[$key])) {
        $tableName = DB_PREFIX . "taxonomy";
        $whereArray = array('key' => MySQL::SQLValue($key), 'parent' => MySQL::SQLValue($parent), 'status' => MySQL::SQLValue('public'));
        $hmdb->SelectRows($tableName, $whereArray);
        if ($hmdb->HasRecords()) {
            if ($parent != 0) {
                echo '<ul class="taxonomy_tree_sub_group taxonomy_tree_sub_group_of_' . $parent . '">';
            }
            while ($row = $hmdb->Row()) {
                $taxs[] = $row;
            }
            foreach ($taxs as $tax) {
                if (in_array($tax->id, $default_value)) {
                    $checked = 'checked';
                } else {
                    $checked = '';
                }
                echo '<li data-id="' . $tax->id . '" data-slug="' . $tax->slug . '" class="tax_tree_item tax_tree_item_' . $tax->id . '">';
                echo '<input type="checkbox" name="taxonomy[]" value="' . $tax->id . '" ' . $checked . ' /> ';
                echo '<label>' . $tax->name . '</label>';
                taxonomy_checkbox_list(array('key' => $key, 'parent' => $tax->id, 'default_value' => $default_value));
                echo '</li>';
            }
            if ($parent != 0) {
                echo '</ul>';
            }
        }
    }
}
开发者ID:butkimtinh,项目名称:hoamai-cms-beta-1.0,代码行数:51,代码来源:taxonomy_model.php

示例13: MySQL

<?php

include_once '../config.php';
include ROOT . "model/Mysql.php";
include 'vheader_aluno.php';
// as pr�ximas 3 linhas s�o respons�veis em se conectar com o bando de dados.
$filter["ALUNO_NOME"] = MySQL::SQLValue('%');
$db = new MySQL();
?>
 
 
 <td width="546" height="300"> 
 
 <?php 
if (!$db) {
    echo " nao conectou <br><br>";
} else {
    echo " conexao OK!<br><br>";
}
echo "Tabela: aluno <p>";
$db->SelectRows("ALUNO");
echo $db->GetHTML();
?>
</td> 

 
 
 
 
开发者ID:marcosyyz,项目名称:self,代码行数:24,代码来源:valunos.php

示例14:

// =========================================================================
// $arrayVariable["column name"] = formatted SQL value
$values["Color"] = MySQL::SQLValue("Violet");
$values["Age"] = MySQL::SQLValue(777, MySQL::SQLVALUE_NUMBER);
// Execute the insert
$result = $db->InsertRow("Test", $values);
// If we have an error
if (!$result) {
    // Show the error and kill the script
    $db->Kill();
} else {
    // No error, show the new record's ID
    echo "The new record's ID is: " . $db->GetLastInsertID() . "\n<br />\n";
    // Show the record using the values array to generate the WHERE clause
    // We will use the SelectRows() method to query the database
    $db->SelectRows("Test", $values);
    // Show the results in an HTML table
    echo $db->GetHTML();
}
// =========================================================================
// Example to delete a row (or rows) in a table matching a filter
// =========================================================================
// Now let's delete that record using the same array for the WHERE clause
$db->DeleteRows("Test", $values);
// =========================================================================
// Example to update an existing row into a table
// =========================================================================
// Create an array that holds the update information
// $arrayVariable["column name"] = formatted SQL value
$update["Color"] = MySQL::SQLValue("Red");
$update["Age"] = MySQL::SQLValue(123, MySQL::SQLVALUE_NUMBER);
开发者ID:elderxavier,项目名称:ultimatemysql,代码行数:31,代码来源:example.queries.php

示例15: thumbnail_media

/** Trả về link thumbnail của file */
function thumbnail_media($id)
{
    $hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
    if (isset($id) and is_numeric($id)) {
        $tableName = DB_PREFIX . "media";
        $whereArray = array('id' => MySQL::SQLValue($id));
        $hmdb->SelectRows($tableName, $whereArray);
        $rowCount = $hmdb->RowCount();
        if ($rowCount != 0) {
            $row = $hmdb->Row();
            $file_info = $row->file_info;
            $file_name = $row->file_name;
            $file_folder = $row->file_folder;
            if ($file_folder != '/') {
                $file_folder = '/' . $file_folder . '/';
            }
            $file_info = json_decode($file_info, TRUE);
            if ($file_info['file_is_image'] == TRUE) {
                $thumbnail_src = SITE_URL . FOLDER_PATH . HM_CONTENT_DIR . '/uploads' . $file_folder . $file_info['thumbnail'];
            } else {
                $file_src_name_ext = strtolower($file_info['file_src_name_ext']);
                $file_ext_icon = './' . HM_CONTENT_DIR . '/icon/fileext/' . $file_src_name_ext . '.png';
                if (file_exists($file_ext_icon)) {
                    $thumbnail_src = SITE_URL . FOLDER_PATH . HM_CONTENT_DIR . '/icon/fileext/' . $file_src_name_ext . '.png';
                } else {
                    $thumbnail_src = SITE_URL . FOLDER_PATH . HM_CONTENT_DIR . '/icon/fileext/blank.png';
                }
            }
            return $thumbnail_src;
        }
    }
}
开发者ID:butkimtinh,项目名称:hoamai-cms-beta-1.0,代码行数:33,代码来源:media_model.php


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