-1

I'm new with PHP and I'm trying to solve this problem but I don't know how.

<?php
    session_start();
    require "../config.php";
    $retvaloff = mysqli_query($con);
    session_destroy();
    header("Location: index.php");
?>

PHP Warning: mysqli_query() expects at least 2 parameters, 1 given in logout.php on line 4

As it says, there is only 1 parameter and it must be 2. Which parameter could I add to mysqli_query?

Thanks!

Dharman
  • 30,962
  • 25
  • 85
  • 135
poteitow
  • 31
  • 7

2 Answers2

0

You should send two parameters to mysqli_query:

  1. db connection and
  2. query.

for reference

At this moment you only send db connections to this function.

davejal
  • 6,009
  • 10
  • 39
  • 82
Mike Foxtech
  • 1,633
  • 1
  • 6
  • 7
0

First parameter to the mysqli_query function is your connection resource (I assume $con in your case), second parameter is the query (string).

PS: Make sure to protect against SQL injection.