Skip to content Skip to sidebar Skip to footer

Organize Display Of Data From Table

i have two tables rsales and salessumarry and i have this ff value. value from salessumarry date | receipt | 09/29/2103 | 112233 | values from rsales name | cate

Solution 1:

I'm sorry If I have misunderstood the question- the code you posted does not seem to produce the output you posted, nevertheless, here's my two cents; I think that to fix the problem you are having with the table headers repeating throughout the results, you need to place the block which reads:

 echo '<tr>';                        
    echo '<th style="border-color:#000000; border-style:solid; border-width:1px;font-size:10px;background-image:url(images/buts3.png);color:white"">Product Code</th>';
    echo '<th style="border-color:#000000; border-style:solid; border-width:1px;font-size:10px;background-image:url(images/buts3.png);color:white"">Name</th>';

In side an if block, such that it only displays once:

if(!$displayed) {
    $displayed = true;
    echo '<tr>';                        
    echo '<th style="border-color:#000000; border-style:solid; border-width:1px;font-size:10px;background-image:url(images/buts3.png);color:white"">Product Code</th>';
    echo '<th style="border-color:#000000; border-style:solid; border-width:1px;font-size:10px;background-image:url(images/buts3.png);color:white"">Name</th>';
}

And do not forget to initialize $displayed to false before the while loop.

In addition, but somewhat aside from the actual question this code you have posted is very insecure, as it is vulnerable to an attack known as sql injection. I recommend you use something like PDO prepared statements to make sure that you do not suffer security problems.


Post a Comment for "Organize Display Of Data From Table"