php - Display two td per row -


here code retrieve data , want display them table. specific each row should contain 2 td data.

//seelct forklft query     $select_part_query = "select distinct part_code, part_desc, part_size, oem, part_image tblpartdetails part_code '%$txtsearch%' or part_desc '%$txtsearch%' or part_size '%$txtsearch%' or oem '%$txtsearch%'";      $result1 = mysqli_query ($mydatabase, $select_part_query);                 if($result1)                 {                     $counter1 = 1;                     while($info1 = mysqli_fetch_array( $result1 ))                      {                         if( $counter1 == 1 )                         {                             echo "<tr>";                         }                             echo '<td style="width:460px; padding:15px;">';                                 echo "<div style='width:430px; height:210px; padding:10px; background-color:rgba(190, 190, 190, 0.8);box-shadow: 12px 0 15px -4px rgba(255, 165, 0, 0.8), -12px 0 8px -4px rgba(255, 165, 0, 0.8);'>";                                     echo "<div style='float:left'>";                                         echo "<img src=".$info1['part_image'] ." width=210px height=210px ></img>";                                     echo "</div>";                                      echo "<div style='width:220px; height:200px; margin-left:210px; padding-left:10px'>";                                         echo "<p class='txtcode' title='part'>".$info1['part_code']."</p>";                                         echo "<p>".$info1['part_desc']."</p>";                                          echo "<div id='btnview' style='width:100px; margin-top:100px; margin-left:120px;'>";                                             echo "<img src='images/view-detail.png' width='100px' height='40px'/>";                                         echo "</div>";                                     echo "</div>";                                 echo "</div>";                             echo "</td>";                         if( $counter1 >= 2)                         {                              echo"</tr>";                         }else{                          $counter1++;                         }                     }                 } 

the result of process should this:

=============     ============= |           |     |           | |   item 1  |     |   item 2  | |           |     |           | =============     =============  =============     ============= |           |     |           | |   item 3  |     |   item 4  | |           |     |           | =============     =============  ============= |           | |   item 5  |  |           | =============  ============= |           | |   item 6  |  |           | =============  ============= |           | |   item 7  |  |           | ============= 

the second condition should compared if( $counter1%2==1)

$result1 = mysqli_query ($mydatabase, $select_part_query);             if($result1)             {                 $counter1 = 0;                 while($info1 = mysqli_fetch_array( $result1 ))                  {                     if( $counter1%2==0 )                     {                         echo "<tr>";                     }                         echo '<td style="width:460px; padding:15px;">';                             echo "<div style='width:430px; height:210px; padding:10px; background-color:rgba(190, 190, 190, 0.8);box-shadow: 12px 0 15px -4px rgba(255, 165, 0, 0.8), -12px 0 8px -4px rgba(255, 165, 0, 0.8);'>";                                 echo "<div style='float:left'>";                                     echo "<img src=".$info1['part_image'] ." width=210px height=210px ></img>";                                 echo "</div>";                                  echo "<div style='width:220px; height:200px; margin-left:210px; padding-left:10px'>";                                     echo "<p class='txtcode' title='part'>".$info1['part_code']."</p>";                                     echo "<p>".$info1['part_desc']."</p>";                                      echo "<div id='btnview' style='width:100px; margin-top:100px; margin-left:120px;'>";                                         echo "<img src='images/view-detail.png' width='100px' height='40px'/>";                                     echo "</div>";                                 echo "</div>";                             echo "</div>";                         echo "</td>";                     if( $counter1%2==1)                     {                          echo "</tr>";                     }                     $counter1++;                  }             } 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -