如何在AJAX调用和响应期间跟踪和纠正会话丢失错误?

I am not getting my " $uid " entered into my database.In everypage there is session_start() . The session_uid inside session.php which is called and included in "includes.php" .This is included in every page of codes using

  include_once"includes.php";

Only this ajax call has this issue , rest ajax functions ae working fine in the same project, which is find very tricky.

Here is the jquery ajax code i use :

$(document).ready(function(){

      $("#update_button").click(function()
     {
           var updateval = $("#update").val();


            var cate=$("#selectcategory").val();
            //var up=$("#uploadvalues").val();



             var dataString = 'update='+updateval+'&Category='+cate;
             if($.trim(updateval).length==0)
                 {
                   alert('ENTER SOME TEXT!!');
                 }
             else
                 {

          $.ajax({
                     type: "POST",
                     url: $.base_url+"message_ajax.php",
                     data: dataString,
                     cache: false,
                     success: function(html)
                   {

                        $("#update").val('').focus();

                         $('#selectcategory').val('');
                      //var c=$('#update_count').html();
                     //$('#update_count').html(parseInt(c)+1);

                     $('#my-awesome-dropzone').hide();
                     }
                  });

                 //$('#imageupload').slideUp('slow');
                  }
                 return false;
                   }); 

                });

message_ajax.php :

               <?php

                    //Load latest update 
                  include_once 'includes.php';

                 if(isSet($_POST['update']))
                  {


                 $update=mysqli_real_escape_string($db,$_POST['update']);
                //$uploads=$_POST['uploads'];

           //Additional field 
               $cat=mysqli_real_escape_string($db,$_POST['Category']);
              //$pvt= $_POST['privacyoptions'];  


                 //new category option
              $data=$obje->Updates_insert($uid,$update,$cat);
              if($data)
                    {
                           include("posts.php");
                    }
                   }
               ?>

The class file in which the function is defined

                class BasicFile{


             public function Updates_insert($uid,$update,$cat)
              {
                 date_default_timezone_set('Asia/Kolkata');
           //echo date('m d G:i:s GMT+5.30 Y');

             $posts=mysqli_real_escape_string($this->db,$update);
             $cate=mysqli_real_escape_string($this->db,$cat);

                $t=time();

                      $da=date("M d Y H:i:s");


            $g=mysqli_query($this->db,"SELECT `username`,`appid`,`profile_pic`,`first_name`,`last_name`,`Class_Dept`,`CollegeName` FROM `users` WHERE `uid`='$uid'") or die(mysqli_error($this->db)); 

            while($det =mysqli_fetch_array($g))
             { 
              $first_name = $det['first_name'];
              $username = $det['username'];
              $last_name = $det['last_name'];
              $app_id= $det['appid'];
              $CollegeName = $det['CollegeName'];

              $Class_Dept = $det['Class_Dept'];
              $profilepic= $det['profile_pic'];
           } 
              $name=$first_name.''.$last_name;
              $cont="image";
                  //mysqli_query($this->db,"INSERT INTO `CommonData`(`content`,`uid`,`category`)VALUES(N'$posts','$uid','$cate')");
                 mysqli_query($this->db,"INSERT INTO `CommonData`(`content`,`uid`,`appid`,`username`,`class`,`collegename`,`contenttype`,`name`,`category`,`like`,`remark`,`time`,`date`,`profilepic`)VALUES(N'$studentposts','$uid','$app_id','$username','$Class_Dept','$CollegeName','$cont','$name','$cate',0,0,'$t','$da','$profilepic')");
                mysqli_query($this->db,"INSERT INTO `NotificationData`(`content`,`uid`,`appid`,`notificationtype`,`username`,`name`,`class`,`collegename`,`category`,`contenttype`,`date`,`profilepic`)VALUES(N'$studentposts','$uid','$app_id','post','$username','$name','$Class_Dept','$CollegeName','$cate','$cont','$da','$profilepic')");
 return true;

                    }
              }

includes.php

            //ob_start("ob_gzhandler");
          error_reporting(0);
             session_start();
       include_once 'includes/db.php';
       include_once 'includes/Updates.php';
          include_once 'includes/textlink.php';
          include 'includes/htmlcode.php';
        include 'includes/nameFilter.php';
         include 'includes/imageCheck.php';
        include 'includes/Wall_Expand.php';
         $obje = new BasicFile($db);
          include_once 'session.php';

       include 'configurations.php';

        /* Session Data */
             include('user_session_data.php');


           $url404=$base_url.'404.php';
          $index_url=$base_url.'login.php';

session.php

                <?php 
                   $session_uid=$_SESSION['uid']; 
             // Session Private
            if(!empty($session_uid))
            {
                  $uid=$session_uid;
                   //$usertype=session_user; 



                         $login='1';
                  }
                    ?>