Skip to content

Instantly share code, notes, and snippets.

@NoMan2000
Created December 10, 2013 17:04
Show Gist options
  • Save NoMan2000/7894143 to your computer and use it in GitHub Desktop.
Save NoMan2000/7894143 to your computer and use it in GitHub Desktop.
PHP loop over a DISTINCT Index Value with option fields
$sql_value = "SELECT DISTINCT siteID FROM users WHERE entityID = $someVariable GROUP BY siteID;";
$sql_res = mysqli_query($dropdown_connect, $sql_value) or die(mysqli_error($dropdown_connect));
while ($row_info = mysqli_fetch_array($sql_res)) {
echo "<option value='$row_info[0] . '>" . $row_info[0] . "<style='width:200px;'></option>";
} // End while loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment