PHP excel reader:databse表显示具有空值的多行 [英] PHp excel reader :databse table shows mutliple rows with empty values

查看:180
本文介绍了PHP excel reader:databse表显示具有空值的多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了一个php脚本来导入excel表格数据到mysql database..code是80%正确..no错误显示..所有excel表数据都添加到表...但问题是数据库表显示一些空单元格的值为0..many没有行出现....
*这里是phpmyadmin表格图像:[访问此] http://i.imgur.com/P1tn3.png
*这里是我的excel表只有4行数据..
* here是我的PHP代码:从此mediafire链接下载: http://www.mediafire.com/?civnwaiolevl7yj



此代码是works..no问题abou那个...这个代码的问题是... b $ b **我认为你都可以理解我的问题...我如何能够在数据库表中保存这些空行...请帮助我恢复这个问题.....

解决方案

测试$ arr [$ i] [1]的值,如果不是空的,请插入。


I have coded a php script to import excel sheet data to mysql database..code is 80% correct ..no errors shows..also all excel sheet data were added to the table...but problem is databse table shows some empty cells with value of 0..many no of rows appeared.... * here is the phpmyadmin table image:[visit this] http://i.imgur.com/P1tn3.png * here is my excel sheet has only 4 rows of data.. * here is my php code :download from this mediafire link : http://www.mediafire.com/?civnwaiolevl7yj

this code is works..no problem abou that...problem is out put of this code.... **I think u all are to can understand my problem...how can i stop saving those empty rows in my db table...please help me to recover this problem.....

解决方案

Test the value of $arr[$i][1] and only do your insert if it's not empty

这篇关于PHP excel reader:databse表显示具有空值的多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆