Re: Re: Lining up items on page
| From: | Ethan Rosenberg | Date: | Fri, 01 Aug 2014 04:05:46 +0000 |
| Subject: | Re: Re: Lining up items on page | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-323705@lists.php.net to get a copy of this message | ||
On 07/30/2014 12:10 AM, Ethan Rosenberg wrote:
On 07/29/2014 11:52 PM, Jim Giner wrote:Jim - This is my solution -- $fptr1 = fopen("to-order.txt", "w+"); $sql1 = "select UPC, manuf, item, quant, stock from Inventory where ordrpt_flag = 1"; $result1 = mysqli_query($cxn, $sql1); ?> <div align="center"> <table border="4" cellpadding="5" cellspacing="55" rules="all" frame="box"> <tr class='heading'> <th>To Order</th> <th>UPC</th> <th>Manufacturer</th> <th>Item</th> </tr> <?php while ($row1 = mysqli_fetch_row($result1)) { ?> <tr> <td> <?php echo $row1[4] -$row1[3] ; ?> </td> <td> <?php echo $row1[0]; ?> </td> <td> <?php echo $row1[1]; ?> </td> <td> <?php echo $row1[2]; ?> </td> </tr> <?php fprintf($fptr1, "%s\t %s\t %-9s\t %s\t\n", $row1[4] -$row1[3], $row1[0],$row1[1],$row1[2] ); } ?> </table> Not too elegant, but it works. EthanOn 7/29/2014 11:36 PM, Ethan Rosenberg wrote:Jim - Thanks. I am outputting to a file. OK - put the data into a table. How do output it to a file, which I will then print. TIA EthanDear list - I wish to align my output. An example- fprintf($fptr1, "%s\t %s\t\n", $row1[0],$row1[1]); In each row of output if the strings are wider than the tab setting, the text will indent. Is there anyway I can formulate the fprinf so that each string will print at a specific place? TIA EthanWhy not use a table?