Wednesday, 14 September 2022

Update Table CodeIgniter

 $DataModel  =new \App\Models\NewsModel();

$DataModel->set('FileName','jpg');

$DataModel->where('id', 101);

$DataModel->update();


Next Topic

File Upload with new name Codeigniter

 HTML

<form method="post"  action="<?php echo site_url('/Admin/newsadddb'); ?>" enctype="multipart/form-data">

 <input type="file" name="NewsFile" id="NewsFile" style="display:none">

<input type="submit" name="submit" value="Save" class="btn btn-danger" >

</form>

Monday, 12 September 2022

Aggregate Function Entity Framework C#

 Sum 

Get Sum of amount by a select filter using C# MVC Entity Framework


First Method

 dbConnection db = new dbConnection();
 int InvoiceAmount = db.Bill.Where(x => x.CID == 123).Select(i => i.Amount).Sum();


Second Method


data.Where(x => x.msg == "paid").Sum(y => Convert.ToInt32(y.Amount));


Next Topic

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