I added function to sort pics according to price they appeared in abnormal size

Viewed 16

[enter image description here][1]

[1]: below is the code of sort by button i don't know why this happens while this is not the actually dimensions of the photos https://i.stack.imgur.com/qxTt1.jpg

 <center>
      <table>
           <?php
           $opt=$_POST['sorting'];
           if ($opt=="low") {
                $qy="SELECT * FROM `men` order by `price` ASC";
                $rt=mysqli_query($con,$qy);
                while ($row1=mysqli_fetch_array($rt)) {
                     ?>
                     <tr style="text-align: center; display: inline;">
                          <td style="border: thin solid lightgrey; width: 300px;
                          height: 200px;">
                          <pre>
                               <img src="<?php echo $row1['img']; ?>">
                               <b> <?php echo $row1['name']; ?> </b>
                               <span style="color: blue; font-weight: bold;">
                                    <?php echo $row1['price']; ?>
                               </span>
                          </pre>
                          </td>

                     </tr>
                     <?php
                }
           }  
           else {
                $qy="SELECT * FROM `men` order by `price` DESC";
                $tt=mysqli_query($con,$qy); 
                while ($row1=mysqli_fetch_array($tt)) {
                     ?>
                     <tr style="text-align: center; display: inline;">
                          <td style="border: thin solid lightgrey; width: 300px;
                          height: 300px;">
                          <pre>
                               <img src="<?php echo    $row1 ['img']; ?>">
                               <b> <?php echo $row1['name']; ?></b>
                               <span style="color: blue; font-weight: bold;"> 
                                    <?php echo $row1['price']; ?>
                               </span>
                          </pre>
                          </td>
                     </tr>
                     <?php
                }
                }
           ?>
           </table>
      </center>
           <?php
}
?>
0 Answers
Related