本文整理汇总了PHP中select_db函数的典型用法代码示例。如果您正苦于以下问题:PHP select_db函数的具体用法?PHP select_db怎么用?PHP select_db使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了select_db函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: id_skpd
function id_skpd($kode)
{
openConnection();
select_db("db_disnakersos");
$sql = "SELECT id_skpd FROM ref_skpd WHERE kode_skpd = '" . $kode . "'";
$query = mysql_query($sql) or die(mysql_error());
$dt = mysql_fetch_array($query);
return $dt["id_skpd"];
}
示例2: select_db
</div>
<?php
if ($u_garage == 1) {
?>
<div class="span4 pull-right" style="text-align:right;">
<form action="index.php?p=<?php
echo $p;
?>
&menu=<?php
echo $menu;
?>
" name="fm_selectmajor" id="fm_selectmajor" method="post" style="margin-bottom:0px;">
<div style="float:left; text-align:right;"><strong>เลือกอู่ต้องการดู</strong> : </div>
<?php
$major_data_list = select_db('majoradmin', "order by dateAdded desc");
?>
<select name="garageId" id="garageId" onchange="fm_selectmajor.submit();" style="width:250px;">
<?php
foreach ($major_data_list as $valMajor) {
?>
<option value="<?php
echo $valMajor['garageId'];
?>
" <?php
if ($thisgarageId == $valMajor['garageId']) {
echo "selected=\"selected\"";
}
?>
><?php
示例3: foreach
<?php
include "../../../include/class.mysqldb.php";
include "../../../include/config.inc.php";
include "../../../include/class.function.php";
foreach ($_REQUEST as $key => $value) {
${$key} = $value;
#echo $key ."=". $value."<br>";
}
$car_model_chk = select_db('carmodel', "where carModelId = '" . $id . "'");
$model_name_edit = $car_model_chk[0]['carModelName'];
echo $model_name_edit;
示例4: Services_JSON
<?php
require_once '../../../include/Zend/JSON.php';
$json = new Services_JSON();
include "../../../include/class.mysqldb.php";
include "../../../include/config.inc.php";
include "../../../include/class.function.php";
foreach ($_REQUEST as $key => $value) {
${$key} = $value;
#echo $key ."=". $value."<br>";
}
$username = trim($username);
$u_garage = trim($u_garage);
$minor_chk = select_db('minoradmin', "where username = '" . $username . "' and garageId = '" . $u_garage . "'");
$find_used = count($minor_chk);
if ($find_used) {
$data['success'] = false;
} else {
$data['success'] = true;
}
echo $_GET['callback'] . '(' . $json->encode($data) . ')';
示例5: connect_to_db
<?php
include 'config.php';
include 'db-functions.php';
$connection = connect_to_db();
select_db();
if (isset($_GET["notificationid"])) {
$query = "SELECT * FROM notification WHERE notificationid = " . $_GET["notificationid"];
} else {
$query = "SELECT * FROM notification";
}
$result = run_query($query);
// Pushes each entry of result into an array and converts it to JSON.
$array = array();
while ($row = mysql_fetch_assoc($result)) {
array_push($array, $row);
}
echo json_encode($array);
close_db($connection);
示例6: main
function main()
{
global $argc;
global $argv;
if ($argc == 1) {
help();
exit;
}
$command = $argv[1];
$commandParam = $argc > 2 ? $argv[2] : '';
switch ($command) {
case 'g':
case 'generate':
if (0 == strlen($commandParam)) {
die('should provide the migration name');
}
@mkdir(dirName);
$fileName = dirName . date('Y_m_d_H_i_s') . '_' . $commandParam . '.sql';
$file = fopen($fileName, 'w+');
// Now UTF-8 - Add byte order mark
fwrite($file, pack('CCC', 0xef, 0xbb, 0xbf));
fclose($file);
print 'generate ' . $fileName . ' done , add your sql statement please' . PHP_EOL;
break;
case 'm':
case 'migrate':
$configs = getDirFiles(configDir);
if (count($configs) > 1) {
if (empty($commandParam)) {
print 'choose the config to use ' . PHP_EOL;
print_r($configs);
print PHP_EOL;
die('multi config file found ,must specify one with the config file name ,for example: php -f msmt.php m default.php');
}
include configDir . '/' . $commandParam;
} else {
include configDir . '/' . $configs[0];
}
global $useMysqli;
checkDBParam($dbHost, '$dbHost');
checkDBParam($dbUser, '$dbUser');
checkDBParam($dbPwd, '$dbPwd');
checkDBParam($dbName, '$dbName');
// read all the schema migrations sql files
$migrations = getDirFiles(dirName);
sort($migrations);
// connect ,may be create the database
if ($useMysqli) {
$conn = mysqli_init();
if (!mysqli_real_connect($conn, $dbHost, $dbUser, $dbPwd)) {
die('connect to db failed,check your db configuration');
}
} else {
$conn = mysql_connect($dbHost, $dbUser, $dbPwd);
}
if (!$conn) {
die('connect to db failed,check your db configuration');
}
$res = select_db($conn, $dbName);
if (!$res) {
print 'can not find database [' . $dbName . '] ,create it for you' . PHP_EOL;
$query = 'create database ' . $dbName;
$res = query($query, $conn);
if (!$res) {
die('create database [' . $dbName . '] failed ' . error($conn));
}
$res = select_db($conn, $dbName);
}
// read the logs,may be create the schema__migrations table
$query = 'show tables like "' . schemaMigrationTable . '"';
$res = query($query, $conn);
$hasTable = false;
if ($res) {
while ($row = $useMysqli ? mysqli_fetch_row($res) : mysql_fetch_row($res)) {
if ($row[0] == schemaMigrationTable) {
$hasTable = true;
break;
}
}
}
if (!$hasTable) {
$res = query('create table ' . schemaMigrationTable . ' (version varchar(50) not null,created_at datetime not null);', $conn);
if (!$res) {
die(' fail to create the ' . schemaMigrationTable . ' table,' . error($conn));
}
print 'create ' . schemaMigrationTable . ' done' . PHP_EOL;
}
$res = query('select version from ' . schemaMigrationTable, $conn);
if (debug) {
print 'all migrate sql file list as below:' . PHP_EOL;
print_r($migrations);
}
// filter to find the never executed migrations
while ($row = $useMysqli ? mysqli_fetch_row($res) : mysql_fetch_row($res)) {
$version = $row[0];
if (debug) {
print 'exists version:' . $version . PHP_EOL;
}
kickout($migrations, $version);
}
//.........这里部分代码省略.........
示例7: select_db
?>
</td>
<td>
<?php
$this_network = select_db('mobilenetwork', "where mobileNetworkId = '" . $mobile_data[$i]['mobileNetworkId'] . "'");
$this_network_name = $this_network[0]['mobileNetworkName'];
?>
<div><?php
echo $this_network_name;
?>
</div>
</td>
<td>
<?php
$this_major = select_db('majoradmin', "where garageId = '" . $mobile_data[$i]['garageId'] . "'");
$this_major_name1 = $this_major[0]['thaiCompanyName'];
$this_major_name2 = $this_major[0]['englishCompanyName'];
?>
<div><?php
echo $this_major_name1;
?>
</div>
<div style="font-style:italic; color:#999; font-size:11px;"><?php
echo $this_major_name2;
?>
</div>
</td>
<td>
示例8: foreach
$i = 0;
foreach ($menuname_arr as $valmenu) {
?>
<div style="padding-top:5px; margin-bottom:10px;">
<h5 class="heading" style="margin-bottom:5px; color:#06C;"><?php
echo $lang_menu[$valmenu];
?>
</h5>
<div class="columns">
<?php
$sql_thismenu = "SELECT * FROM menulist WHERE SUBSTR(menuName,1, INSTR(menuName,'.')-1) = '" . $valmenu . "'";
$rs_thismenu = mysql_query($sql_thismenu);
while ($data_thismenu = @mysql_fetch_object($rs_thismenu)) {
//echo $data_thismenu->menuName;
if (checkArray($data_thismenu->menuName, $menuname_subarr)) {
$data_menuid = select_db('menulist', 'where menuName = "' . $data_thismenu->menuName . '"');
#echo $data_menuid[0]['menuId'];
$i++;
?>
<div>
<label class="uni-checkbox">
<input type="checkbox" id="check_edit<?php
echo $i;
?>
" name="check_edit<?php
echo $i;
?>
" value="<?php
echo $data_menuid[0]['menuId'];
?>
示例9: foreach
<?php
foreach ($_REQUEST as $key => $value) {
${$key} = $value;
//echo $key ."=". $value."<br>";
}
$time_data = select_db('timeschedule', 'where garageId =' . $u_garage . ' order by timeScheduleId');
$total = count($time_data);
?>
<!-- datatable -->
<script src="lib/datatables/jquery.dataTables.min.js"></script>
<script src="lib/datatables/extras/Scroller/media/js/Scroller.min.js"></script>
<!-- datatable functions -->
<script src="js/gebo_datatables.js"></script>
<script type="text/javascript">
var delayAlert=null;
$(document).ready(function(){
$(document).on("keydown.NewActionOnF5", function(e){
var charCode = e.which || e.keyCode;
switch(charCode){
case 116: // F5
e.preventDefault();
window.location = "index.php?p=<?php
echo $p;
?>
&menu=<?php
echo $menu;
?>
";
break;
}
示例10: foreach
<?php
include "../../../include/class.mysqldb.php";
include "../../../include/config.inc.php";
include "../../../include/class.function.php";
foreach ($_REQUEST as $key => $value) {
${$key} = $value;
#echo $key ."=". $value."<br>";
}
$mobile_banner_chk = select_db('mobilebanner', "where mobileBannerId = '" . $id . "'");
$banner_name_eng = $mobile_banner_chk[0]['mobileBannerNameEng'];
$banner_name_thai = $mobile_banner_chk[0]['mobileBannerNameThai'];
echo $banner_name_eng . "," . $banner_name_thai;
示例11: Services_JSON
<?php
require_once '../../../include/Zend/JSON.php';
$json = new Services_JSON();
include "../../../include/class.mysqldb.php";
include "../../../include/config.inc.php";
include "../../../include/class.function.php";
foreach ($_REQUEST as $key => $value) {
${$key} = $value;
#echo $key ."=". $value."<br>";
}
$minor_type_chk = select_db('minortype', "where minorTypeId = '" . $id . "'");
$type_name = $minor_type_chk[0]['minorType'];
$minor_chk = select_db('minoradmin', "where minorTypeId = '" . $id . "'");
$find_used = count($minor_chk);
if ($find_used == 0) {
$TableName = 'minortype';
$sql = delete_db($TableName, array('minorTypeId=' => $id));
//echo $sql;
mysql_query($sql);
$data['success'] = true;
$data['message'] = 'ลบประเภทพนักงาน "' . $type_name . '" เรียบร้อยแล้ว';
} else {
$data['success'] = false;
$data['message'] = 'ลบประเภทพนักงาน "' . $type_name . '" ไม่ได้เนื่องจากมีข้อมูลพนักงานประเภทนี้ในระบบ';
}
echo $_GET['callback'] . '(' . $json->encode($data) . ')';
示例12: Services_JSON
<?php
require_once '../../../include/Zend/JSON.php';
$json = new Services_JSON();
include "../../../include/class.mysqldb.php";
include "../../../include/config.inc.php";
include "../../../include/class.function.php";
foreach ($_REQUEST as $key => $value) {
${$key} = $value;
#echo $key ."=". $value."<br>";
}
$type_name = trim($type_name);
$type_name_temp = trim($type_name_temp);
if ($type_name != $type_name_temp) {
$car_type_chk = select_db('cartype', "where carTypeName = '" . $type_name . "'");
$find_chk = count($car_type_chk);
if ($find_chk) {
$data['success'] = false;
$data['message'] = 'ประเภทรถ "' . $type_name . '" มีแล้วในระบบ';
} else {
$TableName = 'cartype';
$data = array('carTypeName' => $type_name);
$sql = update_db($TableName, array('carTypeId=' => $id), $data);
//echo $sql;
mysql_query($sql);
$data['success'] = true;
$data['message'] = 'ปรับปรุงประเภทรถ "' . $type_name_temp . '" เป็น "' . $type_name . '" เรียบร้อยแล้ว';
}
} else {
$data['success'] = false;
$data['message'] = 'ประเภทรถ "' . $type_name . '" ไม่มีการเปลี่ยนแปลง';
示例13: select_db
<div class="row-fluid search_page">
<div class="span12">
<?php
$car_banner = select_db('carbanner', 'order by carBannerId');
$total_banner = count($car_banner);
if ($total_banner > 0) {
if ($bannerid != '') {
$car_banner_name = select_db('carbanner', "where carBannerId = '" . $bannerid . "'");
} else {
$car_banner_name = select_db('carbanner', "order by carBannerId limit 0,1");
$bannerid = $car_banner_name[0]['carBannerId'];
}
$banner_name = $car_banner_name[0]['carBannerNameEng'];
$car_model = select_db('carmodel', 'where carBannerId = "' . $bannerid . '" order by carModelId');
$total = count($car_model);
?>
<input type="hidden" name="hide_bannerid" id="hide_bannerid" value="<?php
echo $bannerid;
?>
" />
<div class="well clearfix">
<div class="row-fluid">
<div class="pull-left">รายการรุ่นรถยี่ห้อ "<span style="color:#C30; font-weight:bold;"><?php
echo $banner_name;
?>
</span>" มีจำนวน <strong><?php
echo $total;
示例14: select_db
?>
<a href="#" class="ttip_t" title="ดูรายละเอียดเพิ่มเติม" onclick="fn_showInfoCar(<?php
echo $time_data[$i]['carId'];
?>
);">
<?php
echo $carRegistration;
?>
<?php
echo $province_name;
?>
</a>
</td>
<td><i class="splashy-cellphone"></i>
<?php
$mobile_data = select_db('mobile', "where mobileId = '" . $time_data[$i]['mobileId'] . "'");
$mobileNumber = $mobile_data[0]['mobileNumber'];
$lat = $mobile_data[0]['latitude'];
$lon = $mobile_data[0]['longitude'];
?>
<a href="#" class="ttip_t" title="ดูรายละเอียดเพิ่มเติม" onclick="fn_showInfoMobile(<?php
echo $time_data[$i]['mobileId'];
?>
);">
<?php
echo $mobileNumber;
?>
</a>
</td>
<td><?php
echo $lat;
示例15: Services_JSON
<?php
require_once '../../../include/Zend/JSON.php';
$json = new Services_JSON();
include "../../../include/class.mysqldb.php";
include "../../../include/config.inc.php";
include "../../../include/class.function.php";
foreach ($_REQUEST as $key => $value) {
${$key} = $value;
#echo $key ."=". $value."<br>";
}
$minor_data = select_db('minoradmin', "where minorId = '" . $id . "'");
$firstName = $minor_data[0]['firstName'];
$lastName = $minor_data[0]['lastName'];
$TableName = 'minoradmin';
$sql = delete_db($TableName, array('minorId=' => $id));
$rs = mysql_query($sql);
if ($rs) {
$data['success'] = true;
$data['message'] = 'ลบพนักงาน "' . $firstName . ' ' . $lastName . '" เรียบร้อยแล้ว';
} else {
$data['success'] = false;
$data['message'] = 'ลบพนักงาน "' . $firstName . ' ' . $lastName . '" ไม่ได้เนื่องจากมีข้อมูลถูกใช้งานในระบบ';
}
echo $_GET['callback'] . '(' . $json->encode($data) . ')';