Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Want to show results side by side

In our website, after user inserted the input values and hit Go, it will show results. But it’s showing each role. What I am trying to do is, have to show results side by side (Example, Lot ID : Q54497899). I will show the codes as below. I tried to change with if looping and it just only show 1 result.

Current
Currently, it's showing like this.

Intended
enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

echo "<table id='corwafer'>";

    while ($row = mysqli_fetch_assoc($result1)) {
        echo "<tr>";
        echo "<th colspan='2'>Lot ID:</th>";
        echo "<th colspan='2'>Product:</th>";
        echo "<th colspan='3'>EWSFLOW: </th>";
        echo "<th colspan='2'>Zone</th>";
        echo "</tr>";
        
        $field1name = $row["lotid"];
        $field2name = $row["product"];
        $field3name = $row["ewsflow"];
        $field4name = $row["zone"];

        echo '<tr> 
                  <td colspan="2">'.$field1name.'</td> 
                  <td colspan="2">'.$field2name.'</td> 
                  <td colspan="4">'.$field3name.'</td> 
                  <td >'.$field4name.'</td> 
                   
              </tr>';
    }

echo "</table>";

>Solution :

This may not be the best solution but it can be solve with header cells <th> and data cells <td> in one row cell <tr>. Do more research on html table.

echo "<table id='corwafer'>";

while ($row = mysqli_fetch_assoc($result1)) {

    $field1name = $row["lotid"];
    $field2name = $row["product"];
    $field3name = $row["ewsflow"];
    $field4name = $row["zone"];

    echo "<tr>";
    echo "<th colspan='2'>Lot ID:</th>";
    echo "<td colspan='2'>'.$field1name.'</td>";
    echo "</tr>";

    echo "<tr>";
    echo "<th colspan='2'>Product:</th>";
    echo "<td colspan='2'>'.$field2name.'</td>"; 
    echo "</tr>";

    echo "<tr>";
    echo "<th colspan='3'>EWSFLOW: </th>";
    echo "<td colspan='4'>'.$field3name.'</td>"; 
    echo "</tr>";

    echo "<tr>";
    echo "<th colspan='2'>Zone</th>";
    echo "<td>'.$field4name.'</td>"; 
    echo "</tr>";

}

echo "</table>";
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading