as seen in the pic a table. I have the following im trying to fill the boxes based on rows. So line one will fill by the correct ordergoing left to right then down. here is my code.

        $results = mysqli_query($con, " SELECT * FROM PMAsset Order by Linenum, LineOrder") or die(mysqli_error($con));
        while($row = mysqli_fetch_array($results)) {
        ?>
            <tr>
                <td bgcolor="aabbcc"><center><?php echo $row['LineNum']?></td>
                <td Bgcolor=<?php echo $row['PMStatus']?>></td>
                <td Bgcolor=<?php echo $row['PMStatus']?>></td>
                <td Bgcolor=<?php echo $row['PMStatus']?>></td>
                <td Bgcolor=<?php echo $row['PMStatus']?>></td>
                <td Bgcolor=<?php echo $row['PMStatus']?>></td>
                <td Bgcolor=<?php echo $row['PMStatus']?>></td>
                <td Bgcolor=<?php echo $row['PMStatus']?>></td>
                <td Bgcolor=<?php echo $row['PMStatus']?>></td>
                <td Bgcolor=<?php echo $row['PMStatus']?>></td>
                <td Bgcolor=<?php echo $row['PMStatus']?>></td>

            </tr>

        <?php
        }
        ?>

I know im missing a loop but not sure how or where to do it. I want the boxes to sort by Line number then lineorder. then if line is 2 drop to next boxes ect. I have to allow for 10.
Suggestions to help along the way. im close just not understanding the loop

<td Bgcolor=<?php echo $row['PMStatus']?>
this says the Bgcolor= the $row['PMStatus']?
And bgcolor is not a valid style name, and you should be using css to style it anyway.
Also you havn't included you <table> or </table> tabs

You should building it like this.
<table>
then the loop echoing each row (<tr>) with its contents in their <td>
then outside the loop close the table
</table>

But
<td Bgcolor=<?php echo $row['PMStatus']?>></td>
should be
<td><?php echo $row['PMStatus']?></td>

THEN when it works, make it pretty with your css, by giving the table a class and styling the rows and columns once, in the css.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.