Jump to content

Small Mysqli Problem


Dfrtbx

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...