Parsing information from an excel sheet

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kaybaybayy
Forum Newbie
Posts: 1
Joined: Tue Oct 05, 2010 2:40 am

Parsing information from an excel sheet

Post by kaybaybayy »

Alright so I am trying to parse through an excel file using php. In the column that I am first looking at it has the names of various organizations (like "Atlas" "Foto" "Ohana") from the excel sheet and then comparing it with the organization names in an online database. The issue that I am having is that after getting the data from the excel sheet I cannot compare it with the database information. I have tried using strcmp($excel_name, $database_name) as well as if ($excel_name == $database_name) but it always returns -1 or false depending on the situation.

I have tried my best to make sure that both values are strings and I have used trim but I feel like I might be getting the value from the excel sheet incorrectly. When I echo out the values for the $excel_name and $database_name they are the same so I really can't peg the problem.

If anyone has experienced something like this I would love some advice. I've done this sort of thing with python before but I can't seem to get this part. Womp. But either way, thanks!
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Parsing information from an excel sheet

Post by John Cartwright »

Try using the case insensitive version, strcasecmp().

Also, try a var_dump() on both variables and post an example of whats not comparing equally.
Post Reply