Click here to Skip to main content
14,639,480 members
Rate this:
Please Sign up or sign in to vote.
See more:
Notice: trying to access array offset on value of type null in C:\xampp\htdocs\userac\courier_managment_system-master\courier_managment_system-master\delivercourier.php on line 32
query($mysqli);
    $mysqli ="update courier set status = '1' where id = '$cId';";
    echo $mysqli ;
    if($conn->query($mysqli)){
    echo 'success';
    }else{
    echo("Error description: " . mysqli_error($conn));
    }
//    header("Location:deliver.php");
}}


?>
<div class="container-fluid">
 <h1 class="h3 mb-4 text-gray-800">Deliver</h1>
  <div class="row">
   <div class="col-lg-12">
    <div class="card shadow mb-4">
     <div class="card-header py-3">
     <h6 class="m-0 font-weight-bold text-primary">Make Delivery</h6>
     </div>


     <div class="container-fluid" style="margin-top: 1%">
      <div class="row" style="width: 100%"> 
        <div class="col-md-6">
        <div class="container-fluid" style="width: 150%">
         <div class="row justify-content-left">
            <div class="media-container-column col-lg-8" data-form-type="formoid">
         
            
                <div class="form-group" data-for="address">
                Select Courier to deliver
                 
                 query($mysqli);
                 if ($appresult-&gt;num_rows &gt; 0) {
                 while($row = $appresult-&gt;fetch_assoc()) 
                 {
                  ?&gt;
                 Courier to :  || email address : || mobile No :  
                                                
                 
                </div>
                        
                <div class="row row-sm-offset">
                <div class="col-md-8 multi-horizontal">
                <div class="form-group">
                delivered on
                
                </div>
                </div>

                <div class="col-md-8 multi-horizontal" data-for="">
                <div class="form-group">
                delivered TO
                
                </div>
                </div>

                <div class="col-md-8 multi-horizontal" data-for="amount">
                <div class="form-group">
                Delivered BY
                
                query($mysqli);
                if ($appresult-&gt;num_rows &gt; 0) {
                    // output data of each row
                 while($row = $appresult-&gt;fetch_assoc()) 
                 {
                     ?&gt;    
                 
                </div>
                </div>
                </div>
                    
                <span class="input-group-btn">
                deliver Courier  <span class="fa fa-rocket"></span>
                </span>
        
        </div>
        </div>
        </div>
        </div>
            <div class="col-md-6">
            <div class="" style="margin-top: 1%; width: 100%">
            <h3>Deliveries Done</h3>
            
	   num_rows &gt; 0) {
                 // output data of each row
                 while($row = $appresult-&gt;fetch_assoc($appresult)) 
                 {
                  $id = $row['id'];
                  $dto=$row['deliveredTo'];
                  $dby=$row['deliveredBy'];
                  $dt=$row['datetime'];
                  $cid = $row['courierId'];
                ?&gt;
            
	<table id="datatable" class="table table-striped table-bordered"><thead>		<tr>			<th>ID</th>			<th>delivered TO</th>			<th>delivered By</th>			<th>delivered On</th>            <th>Courier Id</th>		</tr>	    </thead>	      <tbody>               <tr>                <td></td>                <td></td>                <td></td>                <td></td>                <td></td>            </tr>            </tbody>    </table>
     </div>
     </div>
     </div></div>  
</div>
</div>
</div></div>

this is query file

What I have tried:

searches but useless i asked to seniors but they not found it
Posted
Updated 14-Sep-20 8:05am
v3
Comments
Sandeep Mewara 14-Sep-20 13:48pm
   
What eaxctly is delivercourier.php on line 32?
Richard Deeming 15-Sep-20 4:41am
   
$mysqli ="update courier set status = '1' where id = '$cId';";

Your code is vulnerable to SQL Injection[^]. NEVER use string concatenation / interpolation to build a SQL query. ALWAYS use a parameterized query.
PHP: SQL Injection - Manual[^]

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Given you have not shared which line, it would be difficult to tell which variable but if you DEBUG or atleast put the code in a file and see the exact line 32, you will figure there is a variable that is NULL and needs handling.

Add isset() checks around the null variables.
Refer: PHP isset() Function[^]
   
Comments
Member 14937499 15-Sep-20 0:43am
   
sir can you wxplain your solution more
Sandeep Mewara 15-Sep-20 1:02am
   
The error meant that within your code, there is a variable or constant that has no value assigned to it. But you may be trying to use in your PHP code.
Member 14937499 15-Sep-20 0:44am
   
$remark = "Your courier has been assigned to" . $rowStaff['name'] . " for delivery.";
tell me is it right syntax bcz it show me syntax error in this query .thanks a lot
Sandeep Mewara 15-Sep-20 1:03am
   
Make sure to share the error you get. Understand, we don't have your code and it's not easy to help just by a line of code at times.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100