title: How to pick multiple rows of values of the same id value from the database and display in ajax?
body: <p>I have written code for button to send a value to php file using ajax as show below :</p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function(){
      $(".open-AddBookDialog").click(function(){
          var packageid = $(this).attr("data-id");
          var dataString =  'packageid='+ packageid;
          $.ajax({
              type: "POST",
              url:  "data1.php",
              data: dataString,
              cache: false,
              success: function(result1){
                  var packagetype = package_type;
                  alert(packagetype);                 
              }
          });
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>This is the ajax code for the button which i have written. My button code is :</p>
  
  <pre><code>   &lt;a data-toggle="modal" id="custId" data-name="&lt;?php echo $arr["package_name"]; ?&gt;" data-id="&lt;?php echo $arr["id"]; ?&gt;" href="#myModal" class="open-AddBookDialog btn btn-submit" OnClick='change(this);'&gt;Book / Enquiry / Pay&lt;/a&gt;
  </code></pre>
  
  <p>When clicking this button in href, I want to send a id value to a php file using ajax.</p>
  
  <p>data1.php</p>
  
  <pre><code>&lt;?php
  include('database.php');
  $id=$_POST['packageid'];
  $query1 = mysqli_query($con,"select * from ayurveda_packagetypes where package_id = '$id'");
  $arr = mysqli_fetch_array($query1);
  echo $arr['package_type'];
  echo $arr['package_price'];
  mysqli_close($con); 
  ?&gt;
  </code></pre>
  
  <p>using the id value, I want to pick multiple rows of package type and package price from the database having the same id value.After picking the multiple rows of these values i want to send it to the main php file and display all the values of all the rows picked from the database.</p>
  
  <p>Can anyone suggest how to do this ?</p>