本文整理汇总了PHP中db_read函数的典型用法代码示例。如果您正苦于以下问题:PHP db_read函数的具体用法?PHP db_read怎么用?PHP db_read使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_read函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: faq
function faq()
{
global $LANG;
$sql = "select * from " . $this->tabela;
$sql .= " where faq_seccao = '" . $this->faq_seccao . "' ";
$sql .= " and faq_idioma = '" . $LANG . "' ";
$sql .= " and faq_ativo = 1";
$sql .= " order by faq_idioma, faq_ordem ";
$rlt = db_query($sql);
$sx = '';
$per = 0;
while ($line = db_read($rlt)) {
$per++;
$sx .= '<BR>' . $per . ' <B>';
$sx .= '<A TAG="#fq' . $line['id_faq'] . '"></A>';
$sx .= '<A HREF="#fq' . $line['id_faq'] . '" style="lt2" onclick="mostra_answer(' . $line['id_faq'] . ');">';
$sx .= trim($line['faq_pergunta']);
$sx .= '</A>';
$sx .= '</B>';
$sx .= '<div id="faq' . $line['id_faq'] . '" style="display: none;" >' . chr(13);
$sx .= mst(trim($line['faq_resposta'])) . chr(13);
$sx .= '</div>' . chr(13);
}
$sx .= '<script>' . chr(13);
$sx .= 'function mostra_answer(id) {' . chr(13);
$sx .= " var local = '#faq'+id; " . chr(13);
$sx .= ' var tela01 = $(local).toggle("slow"); ' . chr(13);
$sx .= '}' . chr(13);
$sx .= '</script>' . chr(13);
return $sx;
}
示例2: index
function index($url = false)
{
$page = false;
$this->load->module('microsite');
if (!$this->microsite->index($url)) {
$lang = $this->session->userdata('lang');
session_write_close();
$id = $this->input->get('id');
if ($id) {
$page = db_read('page', array('id' => $id));
} else {
if ($url) {
$page = db_read('page', array('url' => $url));
} else {
$page = db_read('page', array('main' => 1));
}
}
if (!$page) {
show_404();
exit;
}
$view['page'] = $page;
$view['lang'] = $lang ? $lang : '';
$this->load->view(tpldir('page/' . $page->template), $view);
}
}
示例3: edit
function edit($id = false)
{
if (empty($_POST)) {
$category = db_read('category');
if (!$category) {
redirect(base_url('admin/category/add'));
}
if (!$id) {
$id = $category->id;
}
$view['blogs'] = db_reads('page', array('type' => 'blog', 'catid' => $id));
$view['categories'] = db_reads('category', array('type' => 'blog'));
$view['category'] = db_read('category', array('id' => $id, 'type' => 'blog'));
$this->load->view(tpldir('admin/category/edit_view'), $view);
} else {
$result = jsonSrc();
$id = $this->input->post('id');
$updatecat['name'] = $this->input->post('name');
db_update('category', array('id' => $id), $updatecat);
$result['resultCode'] = 1000;
$result['resultMsg'] = "Success!!";
$result['resultData']['openUrl'] = base_url('admin/category/edit/' . $id);
echo json_encode($result);
}
}
示例4: install_sql
function install_sql()
{
global $base_name;
/* Verificar se existe tabela */
$sql = "SELECT table_name FROM information_schema.tables \n\t\t\t\t\t\tWHERE table_name = 'apoio_titulacao'\n\t\t\t\t\t\t\t\tand table_schema = '{$base_name}' ";
$rlt = db_query($sql);
/* Consulta */
if ($line = db_read($rlt)) {
/* Tabelas já instaladas */
echo 'Database already exist.';
} else {
$file_sql = "../proethos.sql";
/* Le arquivo com estrutura do banco */
$flt = fopen($file_sql, "r");
$sql = "";
while (!feof($flt)) {
$sql .= fread($flt, 1024);
}
fclose($flt);
$ln = splitx(';', $sql . ';');
/* Executa criacao das tabelas */
for ($r = 0; $r < count($ln); $r++) {
echo '<BR>' . substr($ln[$r], 0, strpos('(', $ln[$r]));
$sql = trim($ln[$r]);
if (strlen($sql) > 10) {
$rlt = db_query($sql);
}
}
echo '<BR>Database install!!';
}
}
示例5: edit
function edit($id = false)
{
if (empty($_POST)) {
$menu = db_read('menu_item', array('id' => $id));
if (!$menu) {
$menu = db_read('menu_item');
}
if (!$menu) {
redirect('admin/menu/add');
}
$this->load->module('mod_page');
$view['page'] = false;
$pageResult = $this->mod_page->gets();
if ($pageResult['resultCode'] == 1000) {
$view['page'] = $pageResult['resultData']['page'];
}
$view['menu'] = $menu;
$this->load->view(tpldir('admin/menu/edit_view'), $view);
} else {
$result = jsonSrc();
$id = $this->input->post('id');
$this->load->module('mod_menu');
$result = $this->mod_menu->put($id);
$result['resultData']['openUrl'] = $this->agent->referrer();
echo json_encode($result);
}
}
示例6: curl_check
/**
* @param $appid
* @param $appkey
* @return mixed
*/
function curl_check($appid, $appkey)
{
if (!$appid || !$appkey) {
$err = ErrorCode::BadRequest;
header("HTTP/1.0 " . $err . " " . ConvertErrCodeToMsg($err) . " ", true);
echo "Argument Error.\r\n";
exit;
}
$sql = 'select * from Apps where appid=? and secret=?';
$app = db_read($sql, array(new dbpara('i', $appid), new dbpara('s', $appkey)));
if ($app) {
$ua = $app[0]["cURLAgent"];
$cua = $_SERVER["HTTP_USER_AGENT"];
$err = ErrorCode::Accepted;
if (strlen($ua) != 0 && strcmp($ua, $cua) != 0) {
header("HTTP/1.0 " . $err . " " . ConvertErrCodeToMsg($err) . " ", true);
echo "User-Agent Check Error.\r\n";
exit;
} else {
return $app[0];
}
} else {
$err = ErrorCode::Accepted;
header("HTTP/1.0 " . $err . " " . ConvertErrCodeToMsg($err) . " ", true);
echo "App Auth Error.\r\n";
exit;
}
}
示例7: custom
function custom()
{
$sosmed = db_read('mod_sosmed', array('status' => 1, 'name ' => 'custom'));
if ($sosmed) {
echo $sosmed->url;
}
}
示例8: index
function index()
{
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$admin_auth = $this->session->userdata('admin_auth');
$login_error = $this->session->userdata('login_error');
$this->session->unset_userdata('login_error');
session_write_close();
if ($admin_auth) {
redirect('admin/dashboard');
}
$view['error'] = $login_error;
$this->load->view(tpldir('admin/login/index_view'), $view);
} else {
$username = $this->input->post('username');
$password = hash('sha256', $this->input->post('password'));
$adminRow = db_read('admin', array('username' => $username, 'password' => $password));
if ($adminRow) {
$this->session->set_userdata('admin_auth', true);
$this->session->set_userdata('adminid', $adminRow->id);
$this->session->set_userdata('admin_user', $adminRow->username);
// redirect(base_url('admin/dashboard'));
} else {
$this->session->set_userdata('login_error', 'Invalid Username / password');
}
redirect('admin/login');
}
}
示例9: googleplus
function googleplus()
{
$share = db_read('mod_share', array('status' => 1, 'name' => 'googleplus'));
if ($share) {
$view['share'] = $share;
$view['sharedetail'] = $share ? db_reads('mod_share_detail', array('relid' => $share->id)) : false;
$this->load->view(tpldir('modules/mod_share/googleplus_view'), $view);
}
}
示例10: db_build
function db_build($p, $o)
{
$f = db_f('test');
if ($p) {
db_add($f, $p);
}
$r = db_read($f);
return p($r, 1);
}
示例11: compile_engine
function compile_engine()
{
global $BASEDIR;
global $APPEND;
$order = "bp_name,rule_prio";
$data = db_read("rules,bps", null, array(), $order, 0, 0);
$table = array();
foreach ($data as $def) {
$bp_name = $def["bp_name"];
$rule_prio = $def["rule_prio"];
$statefield = $def["bp_statefield"];
if ($bp_name == "GLOBAL") {
$statefield = "GLOBAL.GLOBAL";
}
if (!$statefield) {
// use default: bpstates
$statefield = "states.state_value:state_env";
}
$def["rule_location"] = split("\n", $def["rule_location"]);
$def["rule_condition"] = split("\n", $def["rule_condition"]);
$def["rule_action"] = split("\n", $def["rule_action"]);
$startvalue = $def["rule_startvalue"];
echo "compiling business process '{$bp_name}' prio {$rule_prio}: acts on {$statefield}<br>\n";
$subcond = array("bp_name" => $bp_name, "rule_prio" => $rule_prio);
$subdata = db_read("conts", null, $subcond, "cont_prio", 0, 0);
foreach ($subdata as $subidx => $subdef) {
$subdata[$subidx]["cont_action"] = split("\n", $subdef["cont_action"]);
}
$def["CONTI"] = array_merge($subdata, $APPEND);
$split = split(":", $statefield);
$state_base = $split[0];
$def["bp_statefield"] = $state_base;
$def["ENV_FIELD"] = @$split[1];
$newsplit = split("\\.", $split[0]);
$def["TABLE"] = $newsplit[0];
$def["FIELD"] = $newsplit[1];
$table[$state_base][] = $def;
}
echo "done.<br>\n";
$code = "<?php // this file was automatically generated by the engine compiler from database tables.\n\n// ====> DO NOT EDIT! <===\n\n";
$code .= "\$ENGINE =\n" . db_data_to_code($table);
$code .= "\n\n?>\n";
$outname = "{$BASEDIR}/compiled/engine_table.php";
$tmpname = "{$outname}.tmp";
$fp = fopen($tmpname, "w");
if (!$fp) {
die("cannot create file '{$outname}'\n");
}
$len = fwrite($fp, $code);
if ($len != strlen($code)) {
die("cannot write temporary file '{$tmpname}'\n");
}
fclose($fp);
rename($tmpname, $outname);
}
示例12: edit
function edit($id = false)
{
if (empty($_POST)) {
$shareRow = db_read('mod_share', array('id' => $id));
if ($shareRow->name == 'twitter') {
$shareDetails = db_reads('mod_share_detail', array('relid' => $id));
$view['share_details'] = $shareDetails;
$view['share'] = $shareRow;
$this->load->view(tpldir('admin/extension/share/edit/twitter_view'), $view);
} elseif ($shareRow->name == 'facebook') {
$shareDetails = db_reads('mod_share_detail', array('relid' => $id));
$view['share_details'] = $shareDetails;
$view['share'] = $shareRow;
$this->load->view(tpldir('admin/extension/share/edit/facebook_view'), $view);
} elseif ($shareRow->name == 'googleplus') {
$shareDetails = db_reads('mod_share_detail', array('relid' => $id));
$view['share_details'] = $shareDetails;
$view['share'] = $shareRow;
$this->load->view(tpldir('admin/extension/share/edit/googleplus_view'), $view);
}
} else {
$result = jsonSrc();
$relid = $this->input->post('relid');
$sosmed = $this->input->post('sosmed');
if ($sosmed == 'twitter') {
$updateContent = false;
$updateContent['name'] = 'tweettext';
$updateContent['value'] = $this->input->post('tweettext');
db_update('mod_share_detail', array('relid' => $relid, 'name' => 'tweettext'), $updateContent);
$updateContent = false;
$updateContent['name'] = 'username';
$updateContent['value'] = $this->input->post('username');
db_update('mod_share_detail', array('relid' => $relid, 'name' => 'username'), $updateContent);
$updateContent = false;
$updateContent['name'] = 'hashtag';
$updateContent['value'] = $this->input->post('hashtag');
db_update('mod_share_detail', array('relid' => $relid, 'name' => 'hashtag'), $updateContent);
$updateContent = false;
$updateContent['status'] = $this->input->post('status');
db_update('mod_share', array('id' => $relid), $updateContent);
} elseif ($sosmed == 'facebook') {
$updateContent = false;
$updateContent['status'] = $this->input->post('status');
db_update('mod_share', array('id' => $relid), $updateContent);
} elseif ($sosmed == 'googleplus') {
$updateContent = false;
$updateContent['status'] = $this->input->post('status');
db_update('mod_share', array('id' => $relid), $updateContent);
}
$result['resultCode'] = 1000;
$result['resultMsg'] = "Content Updated";
$result['resultData']['openUrl'] = base_url('admin/share');
echo json_encode($result);
}
}
示例13: test_sae_db
function test_sae_db()
{
$db = db();
$data = reset(get_data("show global variables like 'read_only';", $db));
$this->assertEqual($data['Value'], 'OFF');
$dbr = db_read();
$data2 = reset(get_data("show global variables like 'read_only';", $dbr));
$this->assertEqual($data2['Value'], 'ON');
// auto
$data3 = reset(get_data("show global variables like 'read_only';"));
$this->assertEqual($data2['Value'], 'ON');
}
示例14: institution_list
function institution_list()
{
$sql = "select * from " . $this->tabela . " ";
$rlt = db_query($sql);
while ($line = db_read($rlt)) {
$sx .= '<TR>';
$sx .= '<TD>';
$sx .= trim($line['it_nome']);
$sx .= '<TD>';
$sx .= trim($line['it_nome_abrev']);
}
}
示例15: user_check
function user_check($uid, $upwd)
{
$sql = 'select * from Users where name=? and password=?';
$user = db_read($sql, array(new dbpara('s', $uid), new dbpara('s', $upwd)));
if ($user) {
return $user[0];
} else {
$err = ErrorCode::Accepted;
header("HTTP/1.0 " . $err . " " . ConvertErrCodeToMsg($err) . " ", true);
echo "User Auth Error.\r\n";
exit;
}
}