Jump to content

Placing sales figures into table


mikebyrne

Recommended Posts

I want to put my sales figures into the table below. The table name is Sales which is linked by using

 

  require_once('adminconnect.php');
  $tbl2 = 'sales';

 

The fields in the table are Date, Total Orders & Revenue. What would the php be to place this into a table?

 

 

<form>	
<!-- data title start -->
<div id="containerBg2">
	<div class="padTop2"><!-- --></div>

	<div class="clr"><!-- --></div>
	<div class="titleBox">
		<table width="850" border="0" cellspacing="0" cellpadding="0">
			<tr align="left">
				<td width="33"> </td>
				<td width="87"><a href="#">date</a></td>
				<td width="43" align="right"><a href="#">orders</a></td>
				<td width="118" align="right"><a href="#">revenue</a></td>

				<td width="569"> </td>
		  </tr>
	  </table>
	</div>
	<div class="clr"><!-- --></div>
</div>
<div class="clr"><!-- --></div>
<!-- data title finish -->



<!-- 1px space start -->

<div id="containerBg1">
	<div class="padTop1"><!-- --></div>
	<div class="clr"><!-- --></div>
</div>
<div class="clr"><!-- --></div>
<!-- 1px space finish -->



<!-- data top start -->
<div id="containerBg3">
	<div class="padTop1"><!-- --></div>

	<div class="clr"><!-- --></div>
</div>
<div class="clr"><!-- --></div>
<!-- data top finish -->



<!-- data content start -->
<div id="containerBg4">





<!-- data btm start -->
<div id="containerBg3">
	<div class="padTop1"><!-- --></div>
	<div class="clr"><!-- --></div>
</div>

<div class="clr"><!-- --></div>
<!-- data btm finish -->





<!-- btm start -->
<div id="containerBg1">
	<div class="padTop15"><!-- --></div>
	<div class="clr"><!-- --></div>
</div>
<div class="clr"><!-- --></div>
<div id="container">

	<div id="line"><!-- --></div>
</div>
<div class="clr"><!-- --></div>
<div class="padTop16"><!-- --></div>
<div class="clr"><!-- --></div>
<!-- btm finish -->

</form>

Link to comment
Share on other sites

Like

 

<?php

include('adminconnect.php');
$sql = mysql_query("SELECT Date, Total Orders, Revenue FROM sales ");
while( $row = mysql_fetch_array($sql) ) {

?>

<tr align="left">  
<td width="87" align="center"><?php echo $row['Date'];?></td>
<td width="43" align="Left"><?php echo $row['Total Orders'];?></td>
<td width="118" align="center"><?php echo $row['Revenue'];?></td>
</tr>


<?
}
?>
</table>

 

Link to comment
Share on other sites

yeah i know that my code is

 

<tr align="left">  
<td width="87" align="center"><?php echo $row['Date'];?></td>
<td width="43" align="Left"><?php echo $row['Total Orders'];?></td>
<td width="118" align="center"><?php echo $row['Revenue'];?></td>
</tr>

 

It goes through the loop but puts the results next to each other as opposed to on  new row

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.