php development Hive web query

巴扎黑
Release: 2016-11-23 13:29:32
Original
1162 people have browsed it

$GLOBALS['THRIFT_ROOT'] = '/data/center_a0001/www/libs/classes/Thrift/';

require_once $GLOBALS['THRIFT_ROOT'] . 'packages/hive_service/ThriftHive.php';

require_once $GLOBALS['THRIFT_ROOT'] . 'transport/TSocket.php';

require_once $GLOBALS['THRIFT_ROOT'] . 'protocol/TBinaryProtocol.php';

$transport = new TSocket('127.0.0.1', 10000);

$protocol = new TBinaryProtocol($transport);

$client = new ThriftHiveClient($protocol);

$transport->open();


$client->execute('use fycenter');

$sql = 'SELECT * FROM orders '.$whereGame.' ORDER BY `time` DESC';

$client->execute($sql);

$result=$client->fetchAll();

$arrList = array();

foreach ($result as $k=>$v) {

$arrTemp = explode("t", $v);

$arrList[$k]['accountName'] = $arrTemp[0];

$arrList[$k]['roleName'] = $arrTemp[1];

$arrList[$k]['orderNumber'] = $arrTemp[2];

$arrList[$k]['money'] = $arrTemp[3];

$arrList[$k]['moneyType'] = $arrTemp[4];

$arrList[$k]['moneyRmb'] = $arrTemp[5];

$arrList[$k]['coin'] = $arrTemp[6];

$arrList[$k]['time'] = $arrTemp[7];

$arrList[$k]['isFirst'] = $arrTemp[8];

}

$smarty->assign('user_list',$arrList);

$smarty->display('gen_user_table.html');


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template