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


PHP query_to_array函数代码示例

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


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

示例1: getValueFromNtnSettings

function getValueFromNtnSettings($param, $default)
{
    $query = "SELECT value FROM ntn_settings WHERE param = '{$param}'";
    $res = query_to_array($query);
    $value = $default;
    if (count($res)) {
        $value = $res[0]['value'];
    }
    return $value;
}
开发者ID:komunikator,项目名称:komunikator,代码行数:10,代码来源:send_message.php

示例2: getMailSettings

function getMailSettings()
{
    // кнопка «Загрузить»
    $sql = "SELECT s.param, s.value FROM ntn_settings s";
    $data = compact_array(query_to_array($sql));
    $ret = array();
    foreach ($data['data'] as $value) {
        $ret[$value[0]] = $value[1];
    }
    // file_put_contents('$test$.txt',print_r($ret,true));
    return $ret;
}
开发者ID:komunikator,项目名称:komunikator,代码行数:12,代码来源:mail_settings.php

示例3: checkUser

function checkUser($called, $caller)
{
    global $mailbox;
    global $user;
    global $file;
    $query = "SELECT count(*) as count FROM extensions WHERE extension='{$called}'";
    $res = query_to_array($query);
    if (!$res[0]["count"]) {
        return false;
    }
    $user = vmGetVoicemailDir($called);
    if (!is_dir($user)) {
        mkdir($user);
    }
    $mailbox = $called;
    $file = vmBuildNewFilename($caller);
    return true;
}
开发者ID:komunikator,项目名称:komunikator,代码行数:18,代码来源:leavemaildb.php

示例4: get_major_counts

function get_major_counts($eid = -1)
{
    $query = "SELECT `ma`, count(*) AS att FROM `users` WHERE `s` = " . PASSPORT_STATE_REGISTERED . " ";
    if ($eid != -1) {
        $query .= "AND `uid` IN (SELECT `uid` FROM `score` WHERE `act` = " . SCORE_TYPE_ATTENDANCE . " AND `eid` = " . $eid . ") ";
    }
    $query .= "GROUP BY `ma` ORDER BY `att`";
    return query_to_array($query);
}
开发者ID:echo0101,项目名称:eScan,代码行数:9,代码来源:dbconn.php

示例5: compact_array

        
            fwd.value as forward,
            fwd_busy.value as forward_busy,
\t    fwd_no_answ.value as forward_noanswer,
\t    no_answ_to.value as noanswer_timeout  
FROM 
   extensions ex 
    left join pbx_settings fwd 
    on fwd.extension_id = ex.extension_id and fwd.param = "forward"
        left join pbx_settings fwd_busy \t\t\t\t\t
            on fwd_busy.extension_id = ex.extension_id and fwd_busy.param = "forward_busy"
                left join pbx_settings fwd_no_answ 
                    on fwd_no_answ.extension_id = ex.extension_id and fwd_no_answ.param = "forward_noanswer"
                        left join pbx_settings no_answ_to 
                            on no_answ_to.extension_id = ex.extension_id and no_answ_to.param = "noanswer_timeout"

WHERE extension = {$number}
\t) a  
EOD;
$data = compact_array(query_to_array($sql . get_filter()));
if (!is_array($data["data"])) {
    echo out(array("success" => false, "message" => $data));
}
$ras = $data['data'][0];
$rak = $data['header'];
$new_array = array();
foreach ($rak as $key => $value) {
    $new_array[$value] = $ras[$key];
}
echo out(array("success" => true, "data" => $new_array));
exit;
开发者ID:komunikator,项目名称:komunikator,代码行数:30,代码来源:get_user_forwarding.php

示例6: out

 *    "Komunikator" technical support e-mail: support@komunikator.ru
 *    The project "Komunikator" are used:
 *      the source code of "YATE" project, http://yate.null.ro/pmwiki/
 *      the source code of "FREESENTRAL" project, http://www.freesentral.com/
 *      "Sencha Ext JS" project libraries, http://www.sencha.com/products/extjs
 *    "Komunikator" web application is a free/libre and open-source software. Therefore it grants user rights
 *  for distribution and (or) modification (including other rights) of this programming solution according
 *  to GNU General Public License terms and conditions published by Free Software Foundation in version 3.
 *    In case the file "License" that describes GNU General Public License terms and conditions,
 *  version 3, is missing (initially goes with software source code), you can visit the official site
 *  http://www.gnu.org/licenses/ and find terms specified in appropriate GNU General Public License
 *  version (version 3 as well).
 *  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 */
if (!$_SESSION['user']) {
    echo out(array("success" => false, "message" => "User is undefined"));
    exit;
}
$total = compact_array(query_to_array("SELECT count(*) FROM playlists"));
if (!is_array($total["data"])) {
    echo out(array("success" => false, "message" => $total));
}
$data = compact_array(query_to_array("SELECT playlist_id as id, playlist, in_use FROM playlists " . get_sql_order_limit()));
//file_put_contents("test.txt","SELECT group_id as id, \"group\", description, extension FROM groups ORDER BY ".get_sql_order_limit());
if (!is_array($data["data"])) {
    echo out(array("success" => false, "message" => $data));
}
$obj = array("success" => true);
$obj["total"] = $total['data'][0][0];
$obj["data"] = $data['data'];
echo out($obj);
开发者ID:komunikator,项目名称:komunikator,代码行数:31,代码来源:get_playlist_extended.php

示例7: out

 *  to GNU General Public License terms and conditions published by Free Software Foundation in version 3.
 *    In case the file "License" that describes GNU General Public License terms and conditions,
 *  version 3, is missing (initially goes with software source code), you can visit the official site
 *  http://www.gnu.org/licenses/ and find terms specified in appropriate GNU General Public License
 *  version (version 3 as well).
 *  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 */
/* получить список групп - модуль "Запись разговора" */
if (!$_SESSION['user']) {
    echo out(array("success" => false, "message" => "User is undefined"));
    exit;
}
$total = compact_array(query_to_array("SELECT ( (SELECT count(*)-1 FROM groups) + (SELECT count(*) FROM extensions) ) count"));
if (!is_array($total["data"])) {
    echo out(array("success" => false, "message" => $total));
}
$sql = <<<EOD
SELECT
    groups.group_id as id,
    groups.group as name
FROM groups
WHERE group_id != 1
EOD;
$data = compact_array(query_to_array($sql));
if (!is_array($data["data"])) {
    echo out(array("success" => false, "message" => $data));
}
$obj = array("success" => true);
$obj["total"] = $total['data'][0][0];
$obj["data"] = $data['data'];
echo out($obj);
开发者ID:komunikator,项目名称:komunikator,代码行数:31,代码来源:get_groups_list.php

示例8: count

  and a.time between  {$cur_date['start']}  and {$cur_date['end']} ;
  EOD; */
$sql = <<<EOD
select count(*)
  from call_history 
  where time between  {$cur_date['start']}  and {$cur_date['end']} ;
EOD;
$data = compact_array(query_to_array($sql));
$f_data[] = array('day_total_calls', $data["data"][0][0]);
$sql = <<<EOD
     select count(*) from extensions 
\t where coalesce(inuse_count,0)!=0;
EOD;
$data = compact_array(query_to_array($sql));
$f_data[] = array('active_calls', $data["data"][0][0]);
$data = compact_array(query_to_array("SELECT count(*) FROM gateways  where status = 'online'"));
$f_data[] = array('active_gateways', $data["data"][0][0]);
function get_userdata($name)
{
    return $_SESSION['userdata'][$name];
}
function set_userdata($ar)
{
    session_start();
    if (!$_SESSION['userdata']) {
        $_SESSION['userdata'] = array();
    }
    foreach ($ar as $key => $value) {
        $_SESSION['userdata'][$key] = $value;
    }
}
开发者ID:komunikator,项目名称:komunikator,代码行数:31,代码来源:get_statistic.php

示例9: out

 *    "Komunikator" project site: http://komunikator.ru/
 *    "Komunikator" technical support e-mail: support@komunikator.ru
 *    The project "Komunikator" are used:
 *      the source code of "YATE" project, http://yate.null.ro/pmwiki/
 *      the source code of "FREESENTRAL" project, http://www.freesentral.com/
 *      "Sencha Ext JS" project libraries, http://www.sencha.com/products/extjs
 *    "Komunikator" web application is a free/libre and open-source software. Therefore it grants user rights
 *  for distribution and (or) modification (including other rights) of this programming solution according
 *  to GNU General Public License terms and conditions published by Free Software Foundation in version 3.
 *    In case the file "License" that describes GNU General Public License terms and conditions,
 *  version 3, is missing (initially goes with software source code), you can visit the official site
 *  http://www.gnu.org/licenses/ and find terms specified in appropriate GNU General Public License
 *  version (version 3 as well).
 *  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 */
if (!$_SESSION['user']) {
    echo out(array("success" => false, "message" => "User is undefined"));
    exit;
}
$total = compact_array(query_to_array("SELECT count(*) FROM time_frames"));
if (!is_array($total["data"])) {
    echo out(array("success" => false, "message" => $total));
}
$data = compact_array(query_to_array("select time_frame_id as id, day, start_hour, end_hour from (SELECT time_frame_id, day, start_hour-{$_SESSION['time_offset']}/60 as start_hour, end_hour-{$_SESSION['time_offset']}/60 as end_hour, case when numeric_day = 0 then 7 else numeric_day end as numeric_day FROM time_frames) a order by numeric_day "));
if (!is_array($data["data"])) {
    echo out(array("success" => false, "message" => $data));
}
$obj = array("success" => true);
$obj["total"] = $total['data'][0][0];
$obj["data"] = $data['data'];
echo out($obj);
开发者ID:komunikator,项目名称:komunikator,代码行数:31,代码来源:get_time_frames.php

示例10: qa

function qa($sql)
{
    $res = query_to_array(query($sql));
    return $res;
}
开发者ID:sgh1986915,项目名称:php-crm,代码行数:5,代码来源:database.php

示例11: out

*    In case the file "License" that describes GNU General Public License terms and conditions,
*  version 3, is missing (initially goes with software source code), you can visit the official site
*  http://www.gnu.org/licenses/ and find terms specified in appropriate GNU General Public License
*  version (version 3 as well).

*  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
*/
if (!$_SESSION['user']) {
    echo out(array("success" => false, "message" => "User is undefined"));
    exit;
}
$id_call_back = getparam('id');
$callthrough_time = getparam('callthrough_time');
$host = $_SERVER['SERVER_ADDR'];
$host = "http://" . $host;
$data = compact_array(query_to_array("SELECT settings FROM call_back WHERE call_back_id = {$id_call_back}"));
if (!is_array($data["data"])) {
    echo out(array("success" => false, "message" => $data));
}
$data = json_decode($data['data'][0][0]);
$color_before = $data[6]->{'7'}->{'field4'};
$color_after = $data[7]->{'8'}->{'field4'};
$main_time = $callthrough_time + 5;
$sec_time = $callthrough_time;
$nPage = $data[2]->{'3'}->{'field4'};
$ua = $data[3]->{'4'}->{'field4'};
$url = $data[5]->{'6'}->{'field4'};
$onUserVisit_check = $data[0]->{'1'}->{'field2'} == '1' ? 'true' : 'false';
$onUserExit_check = $data[1]->{'2'}->{'field2'} == '1' ? 'true' : 'false';
$onCheckURLHistory_check = $data[5]->{'6'}->{'field2'} == '1' ? 'true' : 'false';
$onUserActivity2_check = $data[3]->{'4'}->{'field2'} == '1' ? 'true' : 'false';
开发者ID:komunikator,项目名称:komunikator,代码行数:31,代码来源:get_call_back_code.php

示例12: export_csv_stats_users

function export_csv_stats_users($eventItemId, $conn)
{
    $eventItemId = sql_real_escape_string($eventItemId);
    $query = <<<EOS
SELECT ei100.eventId, ei100.eventTitle, engagedUsers.engagedUsers, allUsers.allUsers
FROM eventitems ei100
INNER JOIN (

SELECT hp.eventItemId, COUNT(*) AS engagedUsers
FROM eventperms hp
WHERE hp.userToken IN (




SELECT DISTINCT pv1.userTicket
FROM  eventitems ei1
INNER JOIN  eventpageviews pv1 ON pv1.nodeId = ei1.eventId AND pv1.pageType = 'eventitem' AND pv1.userTicket IN (SELECT userToken FROM eventperms WHERE eventItemId = ei1.eventId)
where ei1.eventId = hp.eventItemId


UNION

SELECT DISTINCT pv2.userTicket
FROM   eventpools ep2 
INNER JOIN  eventpageviews pv2 ON pv2.nodeId = ep2.poolId AND pv2.pageType = 'eventpool'  AND pv2.userTicket IN (SELECT userToken FROM eventperms WHERE eventItemId = ep2.parentEvent)
WHERE ep2.poolId IN (
SELECT  ep10.poolId 
FROM  eventpools ep10 
WHERE ep10.parentEvent = hp.eventItemId
)


UNION



SELECT DISTINCT pv1.userTicket
FROM  eventitems ei1
INNER JOIN  eventpageviews pv1 ON pv1.nodeId = ei1.eventId AND pv1.pageType = 'eventitem' AND pv1.userTicket IN (SELECT userToken FROM eventperms INNER JOIN eventpools ON parentEvent = eventItemId WHERE poolId = ei1.parentPool)
WHERE ei1.eventId IN (
SELECT  ei20.eventId 
FROM  eventpools ep10 
INNER JOIN  eventitems ei20 ON ei20.parentPool = ep10.poolId
WHERE ep10.parentEvent = hp.eventItemId
)



) GROUP BY hp.eventItemId 

) engagedUsers ON ei100.eventId = engagedUsers.eventItemId
INNER JOIN (

SELECT hp.eventItemId, COUNT(*) AS allUsers
FROM eventperms hp
GROUP BY hp.eventItemId 

) allUsers ON ei100.eventId = allUsers.eventItemId

WHERE ei100.eventId like '{$eventItemId}'

EOS;
    return query_to_array($query, $conn);
}
开发者ID:ValentinMinder,项目名称:pocketcampus,代码行数:65,代码来源:functions.php

示例13: header

 *    "Komunikator" technical support e-mail: support@komunikator.ru
 *    The project "Komunikator" are used:
 *      the source code of "YATE" project, http://yate.null.ro/pmwiki/
 *      the source code of "FREESENTRAL" project, http://www.freesentral.com/
 *      "Sencha Ext JS" project libraries, http://www.sencha.com/products/extjs
 *    "Komunikator" web application is a free/libre and open-source software. Therefore it grants user rights
 *  for distribution and (or) modification (including other rights) of this programming solution according
 *  to GNU General Public License terms and conditions published by Free Software Foundation in version 3.
 *    In case the file "License" that describes GNU General Public License terms and conditions,
 *  version 3, is missing (initially goes with software source code), you can visit the official site
 *  http://www.gnu.org/licenses/ and find terms specified in appropriate GNU General Public License
 *  version (version 3 as well).
 *  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 */
header("Content-Type: application/javascript");
$callback = $_GET["callback"];
$status = 'offline';
$query = "select prompt_id, day, start_hour, end_hour, numeric_day FROM time_frames";
$res = query_to_array($query);
if (count($res)) {
    $day_week = date('w');
    $hour = date('H') * 1;
    $status = 'offline';
    foreach ($res as $row) {
        if ($row["numeric_day"] == $day_week && $row["start_hour"] <= $hour && $hour < $row["end_hour"]) {
            $status = 'online';
        }
    }
}
$jsonResponse = "{\"status\":\"" . $status . "\"}";
echo $callback . "(" . $jsonResponse . ")";
开发者ID:komunikator,项目名称:komunikator,代码行数:31,代码来源:get_work_status.php

示例14: array

$rows = array();
$groups = array();
$result = compact_array(query_to_array('SELECT extension,extension_id FROM extensions'));
if (!is_array($result["data"])) {
    echo out(array("success" => false, "message" => $result));
}
if ($result['data'] && $extensions) {
    foreach ($result['data'] as $row) {
        foreach ($extensions as $key => $value) {
            if ($row[0] == $key) {
                $groups[$row[1]] = $value;
            }
        }
    }
}
$result = compact_array(query_to_array('SELECT groups.group,group_id FROM groups'));
if (!is_array($result['data'])) {
    echo out(array('success' => false, 'message' => $result));
}
if ($result['data'] && $groups) {
    foreach ($result['data'] as $row) {
        foreach ($groups as $key => $value) {
            if ($value == $row[0]) {
                $rows[] = array('extension_id' => $key, 'group_id' => $row[1]);
            }
        }
    }
}
// file_put_contents('b',print_r($rows,true));
$action = 'create_group_members';
include "create.php";
开发者ID:komunikator,项目名称:komunikator,代码行数:31,代码来源:create_extensions.php

示例15: query_to_array

             $caller_group = $value;
             $sql = "SELECT group_id FROM groups WHERE groups.group = '{$caller_group}'";
             $result1 = query_to_array($sql);
             $caller_group_id = $result1[0]['group_id'];
         }
         if ($key == 'called_group' && $value != '') {
             $called_group = $value;
             $sql = "SELECT group_id FROM groups WHERE groups.group = '{$called_group}'";
             $result1 = query_to_array($sql);
             $called_group_id = $result1[0]['group_id'];
         } else {
         }
         if ($key == 'gateway' && $value != '' && $value != '*') {
             $gateway = $value;
             $sql = "SELECT gateway_id FROM gateways WHERE gateways.gateway = '{$gateway}'";
             $result1 = query_to_array($sql);
             $gateway_id = $result1[0]['gateway_id'];
             $values['gateway'] = "'{$gateway_id}'";
         } else {
             $values[$key] = "'{$value}'";
         }
     }
 }
 $rows[] = $values;
 $rows[0]['caller_group'] = $caller_group_id;
 $rows[0]['called_group'] = $called_group_id;
 if ($rows[0]['caller_number'] == "''" && $rows[0]['caller_group'] == "''") {
     $rows[0]['caller_number'] = "'*'";
 }
 if ($rows[0]['called_number'] == "''" && $rows[0]['called_group'] == "''") {
     $rows[0]['called_number'] = "'*'";
开发者ID:komunikator,项目名称:komunikator,代码行数:31,代码来源:create_call_records.php


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