CI escape_str or escape

If you using CI active record then all of the query is already being escape, but what about custom query? You should use escape_str or escape at the where statement. So what is the different between escape_str or escape? which one should we use? Let’s discuss about it. escape Below is the example : $this->db->query(“SELECT …

Disable WordPress Post Page Revision

WordPress provides revision on page or post with 1 minutes interval auto revision / saved. This could feature could make your database become huge, so there’s a way to disable this. Open wp-config.php located in your WordPress root directory and add the following code: define(‘AUTOSAVE_INTERVAL’, 300 ); // seconds define(‘WP_POST_REVISIONS’, false ); The code will …

Detect User Browser in PHP

Lately post is about detecting user’s component in PHP, now is about user’s browser, i used this to make some code’s condition, if its chrome its shows this and etc mostly is about layout. Here is the code : function getBrowser() { $u_agent = $_SERVER[‘HTTP_USER_AGENT’]; $bname = ‘Unknown’; if(preg_match(‘/MSIE/i’,$u_agent) && !preg_match(‘/Opera/i’,$u_agent)) { $bname = ‘Internet …

Jquery replaceWith

I got to learn a new jquery code to this time, its “replaceWith”. I think the function is like replacing a component with the component you want. Code : “$(“#replace_me”).replaceWith( ‘<div id=”replace_me”>New Me</div>’ )” HTML : “<div id=”replace_me”>OLD Me</div>” The result going to be “<div id=”replace_me”>New Me</div>” because “OLD Me” div already being replaced with …