Answers for "Fatal error: Uncaught TypeError: Unsupported operand types: array / int in C:\xampp\htdocs\cv\panel2\general_ajax_code.php:104 Stack trace: #0 {main} thrown in"

PHP
0

Fatal error: Uncaught TypeError: Unsupported operand types: array / int in C:\xampp\htdocs\cv\panel2\general_ajax_code.php:104 Stack trace: #0 {main} thrown in

<?php

include_once"../controller/config.php";

$stm=new config();
extract($_POST);
//limit---------------
$limit=5;
$page=0;
//$output='';


//---------
//.......................

if(isset($_POST['page'])){
    $page=$_POST["page"];
}else{
    $page=1;
}
$start_form=($page-1)*$limit;




$stm2=new config();
$stm2->pag($start_form,$limit);
//------------------
if (isset($_POST['readrecord'])){

    $data='<table class="table table-dark table-bordered table-striped table-hover  " id="example"  >

                <tr>


                            <th >Fullname</th>
                            <th >Tell</th>
                            <th >Email</th>
                            <th >Address</th>
                            <th >About</th>
                            <th >Facebook</th>
                            <th >Telegram</th>
                            <th >Youtube</th>
                            <th ">Interests</th>
                            <th  class="text-center" colspan="3">Actions</th>



                </tr>';

    $stm1=$stm->select_genral_all_data();
//echo json_encode($stm1,JSON_UNESCAPED_UNICODE);


    foreach($stm1 as $item) {

        $data .= '<tr>



             <td>' . substr($item['Fullname'],0,12) . '</td>
             <td>' . substr($item['Tell'],0,10) . '</td>
             <td>' . substr($item['Email'] ,0,10). '</td>
             <td>' . substr($item['Address'],0,10) . '</td>
             <td>' .substr( $item['About'],0,10) . '</td>
             <td>' . substr($item['Facebook'] ,0,10). '</td>
             <td>' . substr($item['Telegram'] ,0,10). '</td>
             <td>' . substr($item['YouTube'] ,0,10). '</td>
             <td>' . substr($item['Interests'],0,7) . '</td>

               <td>
               <Button class="btn btn-info view_data">View</Button>
               <Button id="" onclick="deleteUser(' . $item['id'] . ')" class="btn btn-danger ">Delete</Button>

               <button type="button"  id="'.$item['id'].'"  class="btn btn-primary btn_update" data-target="#Modalgenral_update"  data-toggle="modal" >update</button>
               </td>


        </tr>';


    }






}else{
   $data.='
    <tr>
        <td>data not found</td>
    </tr>

   ';
}
$data.='</table>';
//---pagnition


$total_records=$stm1;


$total_page=ceil($total_records/$limit);







$data.='<ul class="pagination">';
if($page>1){
    $previous=$page-1;
    $data.='<li class="page-item" id="1"><span class="page-link">First page</span></li>';
    $data.='<li class="page-item" id="'.$previous.'"><span class="page-link"><i class="fa fa-arrow-left"></i></span></li>';

}
for($i=1;$i<=$total_page;$i++){
    $active_class="";
    if($i==$page){
        $active_class="active";
    }
    $data.='<li class="page-item '.$active_class.'" id="'.$i.'"><span class="page-link">'.$i.'</span></li>';

}
if($page<$total_page){
    $page++;
    $data.='<li class="page-item" id="'.$page.'"><span class="page-item"><i class="fa fa-arrow-right"></i></span></li>';
    $data.='<li class="page-item" id="'.$total_page.'"><span class="page-link">last page</span></li>';
}
$data.='</ul>';
echo $data;


?>
Posted by: Guest on September-29-2021

Code answers related to "Fatal error: Uncaught TypeError: Unsupported operand types: array / int in C:\xampp\htdocs\cv\panel2\general_ajax_code.php:104 Stack trace: #0 {main} thrown in"

Browse Popular Code Answers by Language