I have a website with 3 dropdown menus that loop through a database in mysql to get 50 bands in a list you can chose. I have made it so if you vote for band number 1, he gets 10 points, number 2, 6 points etc.. Now i have the problem that you can vote for 3 the same bands bcs those dropdown are each looping trough the database. I want to make a global variable so i can put in the query from dropdown 1 of 2 that it doesnt show the chose in dropdown 1.. so like "WHERE NOT LIKE 'variable'" Here is my code for dropdown 1:
<?php echo '<select name="bands1">';
echo '<option>Kies een band</option>';
$sql="SELECT * FROM bands ORDER BY band";
$result = mysqli_query($db_link, $sql);
if (!$result){
die ("Database connection failed!");
}
while($row = mysqli_fetch_assoc($result)){
echo '<option value="' . $row['BandID'] . '">' . $row['band'] . '</option>';
}
echo '</select>';
?>
this is for the 2 other dropdown menus the same only the select name is different
this is my connection file that i included at the top of the html file:
<?php
define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASS', '');
define('DB_NAME', 'mysql_enquete');
$db_link = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME) or die ("Verbindingsfout");
$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if (mysqli_connect_errno()) {
printf("Connect failed: %s
", mysqli_connect_error());
exit();
}
if ($result = $mysqli->query("SELECT DATABASE()")) {
$row = $result->fetch_row();
printf("", $row[0]);
$result->close();
}
?>
Somebody on stackoverflow that can help me?