How to query in Codeigniter with limit and without limit for pagination?

$this->db->start_cache();

$this->db->select("p.*");
$this->db->from('product p');

$this->db->where("p.cat_id", "12");
$this->db->group_by("p.id");

$this->db->stop_cache();

# Get total number of products
$total_product = $this->db->count_all_results();

# show only 5 products
$this->db->limit(5, 0);

$query = $this->db->get();
$this->db->flush_cache();

        
$result 	  = $query->result_array();
$result_count = $query->num_rows();

You cannot call save() after accessing serializer.data in Django Seriliazer

YOU CANNOT CALL `.SAVE()` AFTER ACCESSING `SERIALIZER.DATA`.IF YOU NEED TO ACCESS DATA BEFORE COMMITTING TO THE DATABASE

As the above error says, “If you need to access data before committing to the database then inspect ‘serializer.validated_data’ instead.

Written code:

serializerdata = serializers.CreateSerializer(data=request.data)
if serializerdata.is_valid():
    user_id = serializerdata.data.get('user_id')
    if user_id==2:
        serializerdata.save(i_created_by=request.user)
        return JsonResponse({"message": "success"}) 
    else:
        return JsonResponse({"message": "user invalid"})    
else:
    return JsonResponse({"message": "error"}) 

Solution: we can call this to access the data, like:-

user_id = serializerdata.validated_data.get('user_id')
serializerdata = serializers.CreateSerializer(data=request.data)
if serializerdata.is_valid():
    user_id = serializerdata.validated_data.get('user_id')
    if user_id==2:
        serializerdata.save(i_created_by=request.user)
        return JsonResponse({"message": "success"}) 
    else:
        return JsonResponse({"message": "user invalid"})    
else:
    return JsonResponse({"message": "error"}) 

How to set the timezone in CodeIgniter

date_default_timezone_set() function is used to sets the default timezone used by all date or time functions in core PHP, CodeIgniter etc.

date_default_timezone_set();
date_default_timezone_set('Asia/Kolkata');

# Option-1: In case of CodeIgniter, we can set the default timezone in the application/config.php file

In case of CodeIgniter, we can set the default timezone in the
application/config.php file

<?php

defined('BASEPATH') OR exit('No direct script access allowed');

date_default_timezone_set('Asia/Kolkata');

# Option-2:
Place the code in the main index.php of Codeigniter folder

date_default_timezone_set('Asia/Kolkata');

Google Business Listing has been Suspended Due to Quality Issues!

As, Google Says…..

We may take action on listings and user accounts that violate our content and conduct policies.

If we remove a listing: The public can’t access the listing anymore. The owner and managers can’t take actions on its behalf, though they can still make edits and appeal to be reinstated. If the listing is reinstated, we’ll also reinstate the owner and managers.

If we remove the owner’s Google Account: We’ll also remove all of the listings owned by that user. If we reinstate the owner’s Google Account, we’ll also reinstate the listings.

If we remove a manager’s Google Account: We’ll suspend the manager on the listings they manage, but the listings themselves will be unaffected. If we reinstate the manager’s Google Account, the manager will automatically regain managerial access to the listings.

source: Google

To Know about on google click here: https://support.google.com/maps/forum/AAAAQuUrST8PDj31RqLiTU/?hl=en&gpf=%23!topic%2Fmaps%2FPDj31RqLiTU