mysqli_query() expects at least 2 parameters, 1 given in

Discuss coding issues, and scripts related to PHP and MySQL.
User avatar
JanMolendijk
Posts:282
Location:Holland Rotterdam

mysqli_query() expects at least 2 parameters, 1 given in

I hope you could help me out with this problem

Code: Select all

<?php
session_start();
include_once 'dbconnect.php';

if(!$mid){
$query = mysqli_query("SELECT * FROM users");
$result = mysqli_num_rows($query);
I getting two errors:

Code: Select all

Warning: mysqli_query() expects at least 2 parameters, 1 given in /home/u790012824/public_html/Test/Log-In/profiel.php on line 11

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in /home/u790012824/public_html/Test/Log-In/profiel.php on line 12

Admin Posts:805
Hello
You have to the object with the mysqli connection:

Code: Select all

$query = $conn->query("...");
//OR:
$query = mysqli_query("...", $conn);