News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Johannes Schluter's Blog:
mysqlnd plugins and json
September 14, 2011 @ 11:04:48

Johannes Schluter has shared a handy mysqlnd plugin that he's written up that does two common things at once when you're pulling data from your database and pushing it into JSON - a mysqlnd_query_to_json function.

In my spare time I'm currently writing a shiny Web 2.0 application where I'm heavily using AJAX-like things, so what I do quite often in this application is, basically this: Check some pre-conditions (permissions etc.) then select some data from the database, do a fetch_all to get the complete result set as an array and run it through json_encode; Of course that example is simplified as I'm using the Symfony 2 framework for this project. [...] So I wrote a mysqlnd plugin.

His plugin (that he admits is "a hack") gives you the mysqlnd_query_to_json function that automagically transforms the results from the passed in query into JSON output. He notes some things lacking - like Unicode encoding and no MySQL bitfield support.

0 comments voice your opinion now!
mysqlnd json plugin convert result


blog comments powered by Disqus

Similar Posts

Tobias Schlitt's Blog: PHP Documentor for VIM documented

PHPBuilder.com: Customize Your WordPress Blog with PHP Plugins and Widgets

Leonid Mamchenkov's Blog: Disable and enable CakePHP plugins on the fly

Duckout Blog: Do Funny Stuff with the Google Charts API and PHP

Johannes Schlüter's Blog: Symfony 2 and mysqlnd


Community Events

Don't see your event here?
Let us know!


release language podcast xdebug series api library interview community opinion laravel laravel5 framework php7 voicesoftheelephpant example install unittest extension introduction

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework