-1

`

                $sql = "SELECT * FROM tbl_feedback where status='Pending'";
                $result = $conn->query($sql);

                if ($result->num_rows > 0) {
                        $i=1;

                // output data of each row
                while($row = $result->fetch_assoc()) {
                $loc=$row['location'];
                $inci=$row['incident'];
                $sol=$row['solution'];


                echo "<tr>
                    <td>
                    <a href=editrecipient.php?feed_id=" . $row['feed_id'] . "><button type=button class='btn btn-info btn-xs' data-toggle='tooltip' data-placement='left' title='Edit'><i class='fa fa-pencil'></i></button></a>
                    <a href=recprofile.php?feed_id=" . $row['feed_id'] . "><button type=button class='btn btn-danger btn-xs' data-toggle='tooltip' data-placement='right' title='Delete'><i class='fa fa-trash'></i></button></a>
                    </td>
                    <td>$i</td>
                    <td>$loc</td>
                    <td>$inci</td>
                    <td>$sol</td>
                    <td><button type='button' class='btn btn-default btn-xs'>Post Feedback</button></td>


              </tr>";
              $i++;
                }
                    } else {
                    echo "0 results";
                    }
                $conn->close();


              ?>

` this are the error messages Warning: mysqli::query(): Couldn't fetch mysqli in C:\xampp2\htdocs\Sahana\residentfeedback.php on line 222

Notice: Trying to get property of non-object in C:\xampp2\htdocs\Sahana\residentfeedback.php on line 224 0 results Warning: mysqli::close(): Couldn't fetch mysqli in C:\xampp2\htdocs\Sahana\residentfeedback.php on line 252

1 Answers1

0

I believe there is some rule about adding the close statement right after the query, but i can't seem to find it.

Try adding the $result->close(); right after the sql executes.

TheRock
  • 24
  • 2