Only few Errors left before Upgrading to PHP 8.1
-
Only few Errors exists in two PHP files before Upgrading this code to PHP 8.1 Please suggest me solutions, This will fix the whole script Final error_log:
[08-Apr-2023 15:57:03 UTC] PHP Warning: Undefined array key "m" in message.php on line 88
[08-Apr-2023 15:57:03 UTC] PHP Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AND receiver_id=36376) OR (sender_id =36376 AND receiver_id=) ORDER BY `date_...' at line 1 in message.php:89
Stack trace:
#0 message.php(101): mysqli_query(Object(mysqli), 'SELECT * FROM p...')
#1 {main}
thrown in message.php on line 89
[08-Apr-2023 15:57:25 UTC] PHP Warning: Undefined array key "id" in inbox.php on line 13
[08-Apr-2023 15:57:25 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at inbox.php:13) in inbox.php on line 13message.php Code line 88 and 89:
$query = "SELECT * FROM ".C_MYSQL_MESSAGES." WHERE (sender_id =".$_SESSION['m']." AND receiver_id=". (int)$_GET['id'].") OR (sender_id =".(int)$_GET['id']." AND receiver_id=".$_SESSION['m'].") ORDER BY `date_added` ASC";
$result = mysqli_query($conn,$query) or die();Complete code of message.php
= '7'");
$count=mysqli\_num\_rows($tmp); $row=mysqli\_fetch\_array($tmp); $from\_name=$row\['fname'\].' '.$row\['lname'\]; $from\_id = $row\['id'\]; if($count == '0') { $error = 1; }
}
else
{
$error = 1;
}
if($error == 1)
{
header('location: '.C_URL.'/inbox.php');
die();
}
if(!isset($_SESSION['m']) || $_SESSION['m'] == '')
{
header('location: '.C_URL.'/login.php?redirect_url='.C_URL.'/message.php?id='. (int)$_GET['id']);
}
include_once 'templates/'.C_TEMP.'/config.php';
include_once 'templates/'.C_TEMP.'/header.php';
?>
p.msgtext{
width: 80%;
clear: both;
</x-turndown>