foreach ($groups as $k => $group){
if($k==0){
$condition.=" where a.`groupid`='{$group}'";
}else{
$condition.=" or a.`groupid`='{$group}'";
}
}
$sql = "select a.`uid`,b.`name`,b.`uname`,c.`unit_sn`,d.`name` as group_name,e.`title` from ".$xoopsDB->prefix("groups_users_link")." as a left join ".$xoopsDB->prefix("users")." as b on a.`uid`=b.`uid` left join ".$xoopsDB->prefix("ugm_apply_users")." as c on a.`uid`=c.`uid` left join ".$xoopsDB->prefix("groups")." as d on a.`groupid`=d.`groupid` left join ".$xoopsDB->prefix("ugm_apply_unit")." as e on c.`unit_sn`=e.`sn` {$condition} group by a.`uid` order by a.`uid`";
2013年3月13日 星期三
取得選定群組的會員名單
取得選定群組的會員名單
SQL可以透過關鍵字「distinct」將查詢的資料不重覆顯示
SQL可以透過關鍵字「distinct」將查詢的資料不重覆顯示
範例:
select distinct 欄位名 from 表名 where 查詢準則備註:distinct 必須與 where 子句聯合使用,否則輸出的資料不會有變化
範例:
SELECT DISTINCT a.uid,b.name,b.uname FROM `x4df_groups_users_link` as a left join `x4df_users` as b on a.uid=b.uid WHERE a.groupid =2 OR a.groupid =3
2013年3月10日 星期日
test
//識別名稱(給程式用的) $modversion['config'][1]['name'] = 'show_num'; //顯示標題 $modversion['config'][1]['title'] = '_MI_NOTE_SHOW_NUM'; //偏好設定的說明 $modversion['config'][1]['description'] = '_MI_NOTE_SHOW_NUM_DSC'; //偏好設定的輸入欄位類型 $modversion['config'][1]['formtype'] = 'select'; //偏好設定的輸入值型態 $modversion['config'][1]['valuetype'] = 'int'; //偏好設定的選項設定 $modversion['config'][1]['options'] = array(5=>5,10=>10,15=>15); //偏好設定的預設值。 $modversion['config'][1]['default'] = 10;
2013年2月3日 星期日
2013年1月14日 星期一
釋出xoops模組「petanque」滾球賽務管理(瑞士制)
釋出xoops模組「petanque」滾球賽務管理(瑞士制)
1.無責聲明:本模組為免費釋出之XOOPS模組,育將電腦工作2.本模組目前為測試版1.1
增加「對戰表列印」「場次表列印」
3.下載模組
- 2012-01-26-10-petanque
- 2012-01-27-10-petanque 修正安裝問題
- 2013-01-14_滾球賽務軟體_1.1_petanque.zip增加「對戰表列印」「場次表列印」
使用說明
2012年12月21日 星期五
取得目前的網址
範例:http://demo.webugm.com/www/test.php?op=test&dom=1
- - 取得路徑+檔名: $_SERVER['PHP_SELF']=> /www/test.php 取得參數: $_SERVER['QUERY_STRING']=> op=test&dom=1 取得url: $_SERVER['HTTP_HOST']=> demo.webugm.com 取得路徑+檔名+參數: $_SERVER['REQUEST_URI']=> /www/test.php?op=test&dom=1 1.取得目前檔名: basename ($_SERVER['PHP_SELF'])=> test.php 2. 取得目前路徑: str_replace(basename ($_SERVER['PHP_SELF']),"",$_SERVER['PHP_SELF'])=> /www/ 3. 取得目前絕對路徑: "http://".$_SERVER["HTTP_HOST"].str_replace(basename ($_SERVER['PHP_SELF']),"",$_SERVER['PHP_SELF']); => http://demo.webugm.com/www/ - -
2012年12月11日 星期二
2012年12月7日 星期五
phpexcel 寫入到excel文檔
文章來源:http://blog.163.com/wangkangming2008@126/blog/static/7827792820105121581553/
error_reporting(E_ALL);
set_include_path(get_include_path() . PATH_SEPARATOR . 'classes/');//設置路徑
include 'classes/PHPExcel.php';
include 'classes/PHPExcel/IOFactory.php';
$objPHPExcel = new PHPExcel();
$objPHPExcel->getActiveSheet()->getDefaultColumnDimension()->setWidth(16);//設置單元格寬度
$objPHPExcel->getActiveSheet()->setTitle('test');//設置當前工作表的名稱
//註:單元格第一豎是以0開始的,第一行是以1開始的。
for($j=0;$j<10 div="div" j="j">10>
$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow($j, 1)->getFont()->setBold(true);//設置第一行內容加粗
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($j, 1, 'Test'.($j+1));//設置第一行的標題
for($i=2;$i<12 div="div" i="i">12>
//因為第一行顯示了標題,所以$i是以2開始
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($j, $i, '第'.$i.'行,第'.($j+1).'列');
}
}
$objPHPExcel->createSheet();//創建一個新的工作表
$objPHPExcel->setActiveSheetIndex(1);//設置為當前工作表
$objPHPExcel->getActiveSheet()->getDefaultColumnDimension()->setWidth(16);//設置單元格寬度
$objPHPExcel->getActiveSheet()->setTitle('Details');//設置當前工作表的名稱
/*
$rowVal = array(0=>'Date', 1=>'IP', 2=>'Email');
foreach($rowVal as $k=>$r){
$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow($k, 1)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($k, 1, $r);
}
*/
//設置第一行標題
$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(0, 1)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, 1, 'Date');
$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(1, 1)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, 1, 'IP');
$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(2, 1)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, 1, 'Email');
/***********************
一般這些數據都是從數據庫查詢出來,然後循環輸出。
如:$rs是一個從數據庫查詢出來的數組
$count = count($rs);
for($i=2;$i<$count+2;$i++){
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $i, $rs['date']);
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, $i, $rs['ip']);
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, $i, $rs['email']);
}
***********************/
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, 2, '2009-12-1 星期二');
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, 2, '127.0.0.1');
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, 2, 'andy@palmary.com.hk');
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, 3, '2009-12-1 星期二');
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, 3, '127.0.0.1');
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, 3, '403126795@qq.com');
$objPHPExcel->setActiveSheetIndex(0);//設置打開excel時顯示哪個工作表
$excelName = 'Excel_'.date("YmdHis").'.xls';//設置導出excel的文件名
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=".urlencode($excelName));
header("Content-Transfer-Encoding: binary");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d MYH:i:s") . " GMT");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache");
$objWriter->save('php://output');
?>
數字轉字母(php)
數字轉字母(php)
張貼者:3 分鐘前育將電腦數字轉字母
for ($i = 1; $i < 200; $i++) {
echo $i . ' : ' . num2Letter($i) . '
';
}
function num2Letter($num) {
$num = intval($num);
if ($num <= 0)
return false;
$letterArr = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
$letter = '';
do {
$key = ($num - 1) % 26;
$letter = $letterArr[$key] . $letter;
$num = floor(($num - $key) / 26);
} while ($num > 0);
return $letter;
}
?>
|
2012年12月6日 星期四
tadnews撈「新聞」的方法
tadnews撈「新聞」的方法
張貼者:2012/12/6 上午12:57育將電腦
|
訂閱:
文章 (Atom)

