|
楼主 |
发表于 2010-4-17 14:11:12
|
显示全部楼层
function add_shuju()
{
header("Content-Type:text/html; charset=gb2312");
$name=$_FILES['shuju']['name'];
$wenjian=$_FILES['shuju']['tmp_name'];
$end=end(explode(".","$name"));
$time=date("Ymdhis");
$new_name="$time.$end";
$path="****/$new_name";
move_uploaded_file($wenjian,$path);
$this->load->library('Spreadsheet_Excel_Reader');
$data = new Spreadsheet_Excel_Reader();
$data->setOutputEncoding('gbk');
$data->read('****/'.$new_name);
error_reporting(E_ALL ^ E_NOTICE);
echo "<a href='".base_url()."index.php/admin/shuju/queren/".$time."/".$this->input->post('select')."'>确认</a> ";
echo "<a href='".base_url()."index.php/admin/shuju/shanchu/".$time."'>删除</a> ";
$difang1=$this->input->post('select');
$sql="select * from sm_admin_login where sm_username='$difang1'";
$res=$this->module->query($sql);
foreach($res as $key)
{
$difang=$key->sm_quanxian;
}
if($difang=="0")
{
$mudi="太原";
}
else
{
$mudi=$difang;
}
echo "发往".$mudi;
for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
if($data->sheets[0]['cells'][$i][1]!="")
{
echo "<ul style='width:700px;list-style-type:none; margin:0px;padding:0px;height:10px'>";
echo "<li style='width:120px; float:left;'>".$data->sheets[0]['cells'][$i][1]."</li>";
echo "<li style='width:120px; float:left;'>".$data->sheets[0]['cells'][$i][3]."</li>";
echo "<li style='width:120px; float:left;'>".$data->sheets[0]['cells'][$i][4]."</li>";
echo "<li style='width:120px; float:left;'>".$data->sheets[0]['cells'][$i][7]."</li>";
echo "</ul>";
echo "<br>";
}
}
}
function queren($id,$dd)
{
$sql="select * from sm_admin_login where sm_username='$dd'";
$res=$this->module->query($sql);
foreach($res as $key)
{
$difang=$key->sm_quanxian;
}
header("Content-Type:text/html; charset=gb2312");
$this->load->library('Spreadsheet_Excel_Reader');
$data = new Spreadsheet_Excel_Reader();
$data->setOutputEncoding('gbk');
$data->read('****/'.$id.".xls");
$a=0;
$arr2['biao']=$id.".xls";
$arr2['mudi']=$difang;
$arr2['fasong']=$this->session->userdata('quanxian');
$biao_a="****";
$res_a=$this->module->add($biao_a,$arr2);
for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
if($i>=2)
{
$arr1['shijian']='';
$arr1['mudi']='';
$arr1['danhao']='';
$arr1['shouhuo']='';
if($data->sheets[0]['cells'][$i][1]!="")
{
$arr1['shijian']=$data->sheets[0]['cells'][$i][1];
$arr1['mudi']=$data->sheets[0]['cells'][$i][3];
$arr1['danhao']=$data->sheets[0]['cells'][$i][4];
$arr1['shouhuo']=$data->sheets[0]['cells'][$i][7];
$biao="***";
date_default_timezone_set('PRC');
$arr1['luru']=date("Y-m-d G:i:s");
$res=$this->module->add($biao,$arr1);
if($res)
{
$a=$a+1;
}
}
}
}
if($res_a)
{
echo "发送成功";
}
else
{
echo "发送失败";
}
echo "<br>";
echo "成功录入".$a."条记录";
}
$data->sheets[0]['cells'][$i][7]; 第一个函数里面不报错 第2个函数报错 郁闷
而且7以后的都报错
数据是都能存进去的 但就是很多那样的错误 郁闷
请求高人指点下 |
|