本文整理汇总了PHP中DbConnect::open方法的典型用法代码示例。如果您正苦于以下问题:PHP DbConnect::open方法的具体用法?PHP DbConnect::open怎么用?PHP DbConnect::open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DbConnect
的用法示例。
在下文中一共展示了DbConnect::open方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showSMSqueue
public function showSMSqueue()
{
$smsPath = 'content/tsms/';
$tsms_host = $this->settings['WATCHDOG_TSMS_GATEWAY'];
$tsms_db = 'users';
$tsms_login = $this->settings['WATCHDOG_TSMS_LOGIN'];
$tsms_password = $this->settings['WATCHDOG_TSMS_PASSWORD'];
$tsms_table = $this->settings['WATCHDOG_TSMS_LOGIN'];
$smsArray = array();
$TsmsDB = new DbConnect($tsms_host, $tsms_login, $tsms_password, $tsms_db, $error_reporting = true, $persistent = false);
$TsmsDB->open() or die($TsmsDB->error());
$TsmsDB->query('SET NAMES utf8;');
if (wf_CheckPost(array('showdate'))) {
$date = mysql_real_escape_string($_POST['showdate']);
} else {
$date = '';
}
if (!empty($date)) {
$where = " WHERE `send_time` LIKE '" . $date . "%' ORDER BY `id` DESC;";
} else {
$where = ' ORDER BY `id` DESC LIMIT 50;';
}
$query = "SELECT * from `" . $tsms_table . "`" . $where;
$TsmsDB->query($query);
while ($row = $TsmsDB->fetchassoc()) {
$smsArray[] = $row;
}
//close old datalink
$TsmsDB->close();
//rendering result
$inputs = wf_DatePickerPreset('showdate', curdate());
$inputs .= wf_Submit(__('Show'));
$dateform = wf_Form("", 'POST', $inputs, 'glamour');
$lighter = 'onmouseover="this.className = \'row2\';" onmouseout="this.className = \'row3\';" ';
$cells = wf_TableCell(__('ID'));
$cells .= wf_TableCell(__('Msg ID'));
$cells .= wf_TableCell(__('Mobile'));
$cells .= wf_TableCell(__('Sign'));
$cells .= wf_TableCell(__('Message'));
$cells .= wf_TableCell(__('WAP'));
$cells .= wf_TableCell(__('Cost'));
$cells .= wf_TableCell(__('Send time'));
$cells .= wf_TableCell(__('Sended'));
$cells .= wf_TableCell(__('Status'));
$rows = wf_TableRow($cells, 'row1');
if (!empty($smsArray)) {
foreach ($smsArray as $io => $each) {
$cells = wf_TableCell($each['id']);
$cells .= wf_TableCell($each['msg_id']);
$cells .= wf_TableCell($each['number']);
$cells .= wf_TableCell($each['sign']);
$msg = wf_modal(__('Show'), __('SMS'), $each['message'], '', '300', '200');
$cells .= wf_TableCell($msg);
$cells .= wf_TableCell($each['wappush']);
$cells .= wf_TableCell($each['cost']);
$cells .= wf_TableCell($each['send_time']);
$cells .= wf_TableCell($each['sended']);
$cells .= wf_TableCell($each['status']);
$rows .= wf_tag('tr', false, 'row3', $lighter);
$rows .= $cells;
$rows .= wf_tag('tr', true);
}
}
$result = $dateform;
$result .= wf_TableBody($rows, '100%', '0', 'sortable');
return $result;
}
示例2: DbConnect
function zb_AsteriskQuery($query)
{
global $asteriskHost, $asteriskDb, $asteriskTable, $asteriskLogin, $asteriskPassword, $asteriskCacheTime;
$asteriskDB = new DbConnect($asteriskHost, $asteriskLogin, $asteriskPassword, $asteriskDb, $error_reporting = true, $persistent = false);
$asteriskDB->open() or die($asteriskDB->error());
$result = array();
$asteriskDB->query('SET NAMES utf8;');
$asteriskDB->query($query);
while ($row = $asteriskDB->fetchassoc()) {
$result[] = $row;
}
$asteriskDB->close();
return $result;
}
示例3: turbosmsPushMessages
/**
* Sends all sms storage via TurboSMS service
*
* @return void
*/
protected function turbosmsPushMessages()
{
$sign = $this->safeEscapeString($this->settings['TSMS_SIGN']);
//time shift settings
$timezone = '2';
$tz_offset = (2 - $timezone) * 3600;
$date = date("Y-m-d H:i:s", time() + $tz_offset);
$allSmsQueue = $this->smsQueue->getQueueData();
if (!empty($allSmsQueue)) {
//open new database connection
$TsmsDB = new DbConnect($this->settings['TSMS_GATEWAY'], $this->settings['TSMS_LOGIN'], $this->settings['TSMS_PASSWORD'], 'users', $error_reporting = true, $persistent = false);
$TsmsDB->open() or die($TsmsDB->error());
$TsmsDB->query('SET NAMES utf8;');
foreach ($allSmsQueue as $eachsms) {
if (isset($eachsms['number']) and isset($eachsms['message'])) {
$query = "INSERT INTO `" . $this->settings['TSMS_LOGIN'] . "` ( `number`, `sign`, `message`, `wappush`, `send_time`) VALUES\n ('" . $eachsms['number'] . "', '" . $sign . "', '" . $eachsms['message'] . "', '', '" . $date . "');\n ";
//push new sms to database
$TsmsDB->query($query);
}
//remove old sent message
$this->smsQueue->deleteSms($eachsms['filename']);
}
//close old datalink
$TsmsDB->close();
}
}