Jump to content

Small Mysqli Problem


Recommended Posts

This has worked fine in scripts on other pages, but does not want to work here:

$q = "SELECT * FROM users AS u INNER JOIN referrers AS r ON u.refID = r.refID INNER JOIN users AS ur ON r.userID = ur.userID";$r = mysqli_query ($q, $dbc);

Where $dbc connects to the MySQL database. The error I keep receiving is "Warning: mysqli_query() expects parameter 1 to be mysqli, string given in C:\xampp\htdocs\ ..."

Link to comment
Share on other sites

According to the manual, you either use it with a string like this:

$mysqli = new mysqli("localhost", "my_user", "my_password", "world");$mysqli->query("SELECT * FROM table")

Or you add the string as the second parameter:

$link = mysqli_connect("localhost", "my_user", "my_password", "world");mysqli_query($link, "SELECT * FROM table")

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...