Old PHP Code not working in Newer Versions [duplicate]

I wrote code some time ago which worked using an earlier version of PHP and MySQL.

When I try to do a search for a specific product, it is supposed to display all products containing the key word – let’s say “Monitors”.

Unfortunately I was getting errors. I have found some solutions but as for this “Search” issue, I cannot find a solution. One suggestion was to go from mysql, to mysqli in the code. Still that error persists. I get a very similar error in Login, and Create an account.

The error reads:

Fatal error: Uncaught ArgumentCountError: mysqli_query() expects at
least 2 arguments, 1 given in
C:xampphtdocsComputerSuperStoresearch.php:39 Stack trace: #0
C:xampphtdocsComputerSuperStoresearch.php(39):
mysqli_query(‘select * from p…’) #1 {main} thrown in
C:xampphtdocsComputerSuperStoresearch.php on line 39

The Code Reads:

<?php // Queries All Items using Brand or Looking for specific items 
  $query = "select * from products where Brand like "%$trimmed%" OR Item like "%$trimmed%" OR ItemType like "%$trimmed%" OR Category like "%$trimmed%" order by Brand";

    **Line 39** $numresults=mysqli_query($query); **Line 39**
    $numrows=mysqli_num_rows($numresults);

    if($numrows==0)
    {
      echo"<h2>Results</h2>";
      echo"<p><h3>Sorry, your search for</h3><h2> &quot; ". $trimmed . " &quot; </h2><h3>Returned zero results...</h3></p>";
    }

    if(empty($s))
    {
        $s=0;
    }

    $query .= " limit $s,$limit";
    $result = mysqli_query($query) or die("Couldn't execute query");
    //echo"Results";
    $count = 1 + $s;
    
    while ($row=mysqli_fetch_assoc($result)) {
        include ('tablelogincheck.php');
    }
?>

I have highlighted the line where it says there is an error using ** Line 39**.

Previously i used mysql_ and as I said, it all worked fine in the older version.

I changed it to mysqli_ but it has not fixed the errors in Search, Login, Create Account.

The latter 2 give very similar errors – just a different line number.

I have spent a fair time trying to figure it out (years) and to no avail. Any help would be appreciated.