如何从PHP页面上的数据库表中获取数据

I have created one IMS in that I am trying to fetch data from one table from the database and display it in drop-down form to another page. In the database, I have created one table named a party in that table one column named party_name is available and I have to fetch that column data to my order page. Below is my Code. If anyone knows a solution than please help.

<select name="party[]" style="width:100%;" required>
   <?php
     $result=mysql_query("SELECT * FROM partys");
     while ($row = mysql_fetch_array($result)) {
   ?>
   <option value="<?php echo $row['id'];?>"><?php echo $row['party_name'];?></option>
   <?php
    }
   ?>
</select>

Firstly: mysql extension is deprecated, you should use at least mysqli_*:

Secondly: try the below example, replacing the database connection string variables with your database credentials:

<select name="party[]" style="width:100%;" required>
  <option value="">-- Please select --</option>
<?php
  $dbc = mysqli_connect('localhost', 'userName', 'password', 'databaseName')
    or die('Error connecting to MySQL server.');
  $query = "SELECT * FROM partys";
  $result = mysqli_query($dbc, $query);
  while ($row = mysqli_fetch_array($result)) {
?>
  <option value="<?php echo $row['id'];?>"><?php echo $row['party_name'];?></option>
<?php } ?>
</select>