synking Posted August 21, 2012 Share Posted August 21, 2012 Hey guys, Just have a question as i looked on google but didn't find too much. I want to export a table to CSV so that it can be opened in excel and edited if needed. But the question is using PDO, would it be better for mysql to create this csv with a intofile query or should i have php use the fputcsv functions. I have not seen much on using that with pdo so i thought i would see what everyone thought. Quote Link to comment https://forums.phpfreaks.com/topic/267388-pdo-export-to-csv/ Share on other sites More sharing options...
xyph Posted August 21, 2012 Share Posted August 21, 2012 INTOFILE would most likely be more efficient, but would be MySQL-specific. If you want to take full advantage of the abstraction PDO gives you, I'd bring the data into PHP and parse it there - you can easily do this with ANSI/ODBC standard code. If you only plan on using MySQL, and want to maximize efficiency around this, then use INTO OUTFILE Quote Link to comment https://forums.phpfreaks.com/topic/267388-pdo-export-to-csv/#findComment-1371266 Share on other sites More sharing options...
synking Posted August 21, 2012 Author Share Posted August 21, 2012 Thank you yeah im just using this to dispaly in an excel file not trying to import it or anything. So i will just use that. Quote Link to comment https://forums.phpfreaks.com/topic/267388-pdo-export-to-csv/#findComment-1371282 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.