Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. Only few Errors left before Upgrading to PHP 8.1

Only few Errors left before Upgrading to PHP 8.1

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
databasedata-structureshelpphpmysql
1 Posts 1 Posters 7 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Aruna KN
    wrote on last edited by
    #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 13

    message.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>

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups