红利卡积分会员数据导入
选择你要导入的数据表
[注]数据导入格式说明:
1、其它.导入数据表文件必须是execel文件格式{.xls}为扩展名.
2、execel文件导入数据顺序必须如:会员名称 | 会员卡号 | 身份证 | 积份 | 注册时间 | 过期日期 | 联系电话号码 如下图:
setoutputencoding('gb2312');
$data->read($import_tmpfile);
$array =array();
for ($i = 1; $i sheets[0]['numrows']; $i++) {
for ($j = 1; $j sheets[0]['numcols']; $j++) {
$array[$i][$j] = $data->sheets[0]['cells'][$i][$j];
}
}
sava_data($array);
}
function sava_data($array){
$count =0;
$total =0;
foreach( $array as $tmp){
$isql = select inte_card from gx_integral where inte_card='.$tmp[2].';
$sql = insert into gx_integral(inte_name,inte_card,inte_status,inte_integral,inte_date,inte_date2,inte_tel) value(;
$sql.='.$tmp[1].','.$tmp[2].','.$tmp[3].','.$tmp[4].','.ttod($tmp[5]).','.ttod($tmp[6]).','.$tmp[7].');
if(! mysql_num_rows(mysql_query($isql) )){
if( mysql_query($sql) ){
$count++;
}
}
$total++;
}
echo ;
}
function ttod($text){
$jd1900 = gregoriantojd(1, 1, 1900)-2;
$myjd = $text+$jd1900;
$mydate = jdtogregorian($myjd);
$mydate = explode('/',$mydate);
$mydatestr = str_pad($mydate[2],4,'0', str_pad_left).-.str_pad($mydate[0],2,'0', str_pad_left).-.str_pad($mydate[1],2,'0', str_pad_left);
return $mydatestr;
}
?>
这里是用到spreadsheet_excel_reader组件了,那read.php文件我就不附上了,自己下一个吧,好了最后申明本站原创转载请注明: www.111cn.cn
http://www.bkjia.com/phpjc/630430.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/630430.htmltecharticlestyle type=text/css !-- @import url(../style/admin.css); .style1 { color: #ff0000; font-weight: bold; } .style2 {color: #0033ff} -- /style script function import_check(){ var f_con...
