We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Batch Insert

Since I couldn't find a way to Batch Insert in PhalconPHP I started creating a mockup here is my Gist. It's quite messy still and doesn't escape characters for the values, so it's not trustworthy yet. If anyone wants to improve it feel free!

Also, I placed this in my BaseController.php file so it's available to every controller for my pleasure. And suggestions would be appreciated.



98.9k
edited Mar '14

Thanks for contributing, also, I suggest you use bound parameters to avoid SQL injection attacks, sprintf is not the best function to escape values.

Agreed, I got too excited and posted it :) I will update it once my husband duties are done :)

This is awesome - thanks for posting. It was a lifesaver last week. I forked it and added support for other data types (int and null) in the stringify() method. Here's my fork:

https://gist.github.com/afischoff/9608738

Nice work Andy thanks!

Very nice. Thanks!