Thursday, 28 July 2022

PHP Date Manipulation


Convert Date in dd/mm/yyyy (28-07-2022) format coming from database.

 echo date("d-m-Y", strtotime($item['CreatedDate']));

Next Topic

Wednesday, 6 July 2022

Google Captcha Integration in Codeiginater 4

 Step 1 : 

    Signup to Google Recaptcha and get the public and private key.

Step 2 :

    Make a Model named CaptchaResponse in Model folder and add the given code below.

Monday, 4 July 2022

Delete from database in Codeiginater 4

Function

 public function DelContact($field,$val)

    {       

         $db = new ContactModel();

         $db->where($field,$val)->delete();

       return redirect()->to(site_url('admin/contact'));

    }


Calling

<a href="<?php echo site_url('admin/DelContact/ID/123'); ?>" onclick="return confirm('Are you sure to delete this record')">


Next Topic