Re: Re: Lining up items on page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/30/2014 12:10 AM, Ethan Rosenberg wrote:
On 07/29/2014 11:52 PM, Jim Giner wrote:
On 7/29/2014 11:36 PM, Ethan Rosenberg wrote:
Dear 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

Ethan

Why not use a table?


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

Ethan

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.

Ethan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux