Note that there are some explanatory texts on larger screens.

plurals
  1. POWarning when calling mysqli_error()
    text
    copied!<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/1654958/php-warning-help">PHP warning help?</a> </p> </blockquote> <p>I'm trying to join three tables from a database in-order to display a users selected categories but I get the following error.</p> <pre><code>Warning: mysqli_error() expects exactly 1 parameter, 0 given in </code></pre> <p>I think I'm doing something wrong when I query my database.</p> <p>Here is the code below.</p> <pre><code>// Query member data from the database and ready it for display $mysqli = new mysqli("localhost", "root", "", "sitename"); $dbc = mysqli_query($mysqli,"SELECT users.*, categories.*, users_categories.* FROM users_categories INNER JOIN users_categories ON users_categories.user_id = users.user_id JOIN categories ON users_categories.user_id = users.user_id WHERE users_categories.user_id=3"); if (!$dbc) { // There was an error...do something about it here... print mysqli_error(); } //Users entered category loop while ($row = mysqli_fetch_assoc($dbc)) { if (! empty($row['category'])) { echo '&lt;div class="skill-info"&gt;'; echo '&lt;p&gt;' , htmlspecialchars($row['category']) , '&lt;/p&gt;'; } } </code></pre> <p>Here is my MySQL tables structure.</p> <pre><code>CREATE TABLE users ( user_id INT UNSIGNED NOT NULL AUTO_INCREMENT, user_name VARCHAR(255) NOT NULL, PRIMARY KEY (user_id) ); CREATE TABLE categories ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, parent_id INT UNSIGNED NOT NULL DEFAULT 0, category VARCHAR(255) NOT NULL, url VARCHAR(255) NOT NULL, PRIMARY KEY (id), INDEX parent (parent_id) ); CREATE TABLE users_categories ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, user_id INT UNSIGNED NOT NULL, category_id INT UNSIGNED NOT NULL, PRIMARY KEY (id) ); </code></pre> <p>Now I get the following error</p> <pre><code>Not unique table/alias: 'users_categories' </code></pre> <p>How do I fix this?</p> <p>Thanks everyone for the help. Is there a way i can reward every one for there help here on stackoverflow instead of one person?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload