get data from database in dropdown list php
snippet in php

get data from database in dropdown list php

user2589

<?php
$connect = new mysqli("127.0.0.1","root","");

			if ($connect -> connect_errno)
				{
			  		echo "Failed to connect to MySQL: " . $connect -> connect_error;
			  		exit();
				}

					$connect -> select_db("Your Database");
				if ($result = $connect -> query("Your query")) 
  				{
			  		
				}
				echo "<select>";
				while($row = mysqli_fetch_array($result)) 
				{
					echo "<option>" . $row['Your columns'] . "</option>"
				}
				echo "</select>"
?>