#Convert stdClass object to array in PHP The easiest way is to JSON-encode your object and then decode it back to an array: $array = …
Read MoreWhich Version of Codeigniter I am using?
#Which version of CodeIgniter am I currently using? Ans: Yes, the constant CI_VERSION will give you the current CodeIgniter version number. CodeIgniter 2, it’s defined …
Read MoreWhether we can have a form inside another form?
#Whether we can have a form inside another form? Though you can have several <form> elements in one HTML page, you cannot nest them. We …
Read Moreget last insert id after insert query in codeigniter active record
– get last insert id after insert query in codeigniter active record function add_post($post_data){ $this->db->insert(‘posts’, $post_data); $insert_id = $this->db->insert_id(); return $insert_id; } …
Read Morehow to get last insert id after insert query in codeigniter active record
#how to get last insert id after insert query in codeigniter active record Example: For add data into table, function add_post($post_data){ $this->db->insert(‘posts’, $post_data); …
Read MoreDecode html encoded contents in php
## Html contents decode in php $contents = Original Content with html encoded tags; $contents_decoded = htmlspecialchars_decode($contents, ENT_QUOTES); echo html_entity_decode($contents_decoded);
Read MoreOrder By Rand in Codeigniter
#Order By Rand in Codeigniter function get_random_page() { $this->db->order_by(‘id’, ‘RANDOM’); or $this->db->order_by(‘rand()’); $this->db->limit(1); $query = $this->db->get(‘pages’); return $query->result_array(); } Codeigniter provides the use of ‘RANDOM’ …
Read MoreCheck if input box checked in jQuery
## Check if the checkbox is checked or not. Here, checkbox is the id of checkbox. $(‘#checkbox’).on(‘click’, function(){ if ($(this).is(‘:checked’)== true) { console.log(‘Checked’); } else …
Read MorePreg match in Jquery
CHECK EXPRESSION LIKE:: 11112233-1234 <input type=”text” value=”” name=”preg” id=”preg” placeholder=”11112233-1234″ form-control”> <script type=”text/javascript”> $(‘#preg’).on(‘keyup’, function(){ var dis = $(this); var _preg = “[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][-][0-9][0-9][0-9][0-9]”; if(dis.val().match(/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][-][0-9][0-9][0-9][0-9]/)){ console.log(‘Matched’); …
Read MoreRemove br tag from the content in php
#Remove br tag from the content in php $content = HERE ALL YOUR CONTENTS; $content = str_replace(“<br />”,””,$content); $content = str_replace(“<br>”,””,$content); $content = str_replace(“<br/>”,””,$content);
Read More