954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

validating CSV before saving in MYSQL

hi all
could someone plz help me out in validating csv file(excel sheet) before i can insert it into the database?:?:
i hv the code for uploading but not validating
reply ASAP.
cheers
coder

php_coder
Light Poster
34 posts since Dec 2006
Reputation Points: 10
Solved Threads: 0
 

Ok, here's a hint: CSV files are normally just plain text. You have to read the information in before you can do anything with it.

Puckdropper
Posting Pro
500 posts since Jul 2004
Reputation Points: 23
Solved Threads: 23
 
DennisP
Newbie Poster
23 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 
http://codewalkers.com/seecode/585.html If you're lazy like me.


Hi
thanks for the reply. But i hv already done what you hv sent me....
my csv contains firstname,lastname,email id. So i have to validate the
email and not allow specialchar other than @. The following is my code.....
if($_REQUEST['submit'])
{
$errmsg="";
$contents = file ('./email_entries.csv');
for($i=0; $i

php_coder
Light Poster
34 posts since Dec 2006
Reputation Points: 10
Solved Threads: 0
 

PHP_CODER did you finish your project and learn how to validate the csv contents. I'm exactly at the point where you were when you asked your qustion. If you did find out how to do the validation please can you post the answer.

Thx

morecambe
Newbie Poster
2 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
 
BzzBee
Posting Whiz
327 posts since Apr 2009
Reputation Points: 16
Solved Threads: 48
 

see this link. may be it can help you

http://www.bigresource.com/PHP-CSV-file-content-validation-hYLSnyxf.html


Thanks for your message but I already saw that link - it's actually useless - it just takes me to another forum here with half a reply: http://www.phpfreaks.com/forums/index.php?topic=158173

morecambe
Newbie Poster
2 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You