Loop through Columns

Topics: Developer Forum, Project Management Forum, User Forum
Oct 12, 2012 at 3:23 PM

Is there a function that loops through columns. The reason I ask is because I want to loop through columns and drop data for specific columns in Mysql. I think it would be easier for me to build an array for my columns and execute my insert statement.

Oct 13, 2012 at 5:32 PM

There is no built-in function for looping through columns, only for looping through rows and for cells within rows. You'd need to do this yourself.

The most obvious would be to loop through each row number, using the toArray() method, and then do an array_intersect_key() against an array containing the columns that you need.