Share the post "How To Show JSON Array Only In Recess PHP Controller"
By default, Recess PHPs’s JsonView class responds with the properties of your controller. So even if you create a custom route that outputs only an array, a default row of the controller’s model will also be included with null values.
You can override this using the OKResponse class. You can do it like this.
return new OkResponse ( $this -> request , array ( 'myarray' = > $this -> myarray ) ) ;
Share the post "PHP MySQL Result json_encode Includes Value And Its Column Index As Key"
While this is not really an error, extra data that is not used should not be included in any output as it will only add to the extra bytes.
When you look at your JSON output, you realized the column names and values also have extra index column numbers and the associated values included.
To remove this, simply add an option in the PDO when you instantiate a database connection in PHP like this:
<?php $db = new PDO ( "mysql:host=localhost; dbname=mydbname" , "myusername" , "mypassword" ) ; $db -> setAttribute ( PDO:: ATTR_DEFAULT_FETCH_MODE , PDO:: FETCH_ASSOC ) ; ?>
That should fix the problem. When you use json_encode(), there will be no more duplicate values with the corresponding column index number as key.
Share the post "Don’t Upgrade To WordPress 3.8!"
This was a mess. I did not expect WordPress 3.8 to slow down my blog site. As in literally! The admin console takes too long to load and so do my blog posts.
I tried to look in the web for a solution but it seems people are blaming the hosting provider or possible WordPress plugins. Unbelievable!
Everything was in good condition until I pressed that update button. And it is quite a hassle downgrading so it totally sucks. If you have not upgraded to WordPress 3.8, DON’T!!!
Sure, the visuals look appealing but who surfs the web in their phones in the first place? Just go download the WordPress app.
If you upgrade to WordPress 3.8, it will be hell for you. Load time is slow and you will see connection timed out messages quite often especially while you compose a new post.
Now my monetization chances are getting slimmer because if the advertiser sees your site as loading at a snail pace, they will ignore your website.
So if you are still with version 3.7, stick with it! It won’t hurt you.