4,250
社区成员




- $db = create_peardb_handle();
- $subHotel_temp=fopen("test.csv","r");//连接EXCEL文件,格式为了.csv
- $subHotel_q=$db->query("insert into hotel_activities_2(hotel_id,start_date,end_date,content,s_type) values('");
- while ($subHotel_data = fgetcsv ($subHotel_temp, 1000, ",")) {
- $subHotel_num = count ($subHotel_data);
- for ($i=0;$i<$subHotel_num;$i++)
- {
- if($i==$subHotel_num-1){$subHotel_q=$subHotel_q.$subHotel_data[$i]."')";break;}
- $subHotel_q=$subHotel_q.$subHotel_data[$i]."','";
- }
- echo "SQL语句执行成功";
- $sql=$db->query("insert into hotel_activities_2(hotel_id,start_date,end_date,content,s_type) values('");
- fclose ($subHotel_temp);