Bentuk laporan

Bella · Aug 19, 2012
mas saya pyk tb kayak gini:
tb_members :
|tgl |mem_id |ambil|jual|
|29/05/2012|R236929693|10 |2 |
|29/05/2012|R417409972|43 |5 |
|29/05/2012|R492849777|30 |1 |
|29/05/2012|R522445347|17 |2 |
|29/05/2012|R665985398|12 |4 |
|29/05/2012|R764750298|29 |8 |
|29/05/2012|R956336961|54 |2 |
|30/05/2012|R236929693|5 |1 |
|30/05/2012|R417409972|4 |2 |
|30/05/2012|R492849777|2 |1 |
|30/05/2012|R522445347|3 |1 |
|30/05/2012|R665985398|7 |1 |
|30/05/2012|R764750298|6 |1 |
|30/05/2012|R956336961|3 |1 |
|31/05/2012|R236929693|20 |4 |
|31/05/2012|R417409972|35 |1 |
|31/05/2012|R492849777|15 |1 |
|31/05/2012|R522445347|20 |1 |
|31/05/2012|R665985398|5 |1 |
|31/05/2012|R764750298|10 |1 |
|31/05/2012|R956336961|20 |1 |

saya pengen bentuk laporannya kayak gini ..

==============================
|No.|Members ID|Ambil|Terjual|
==============================
|1 |R236929693|10 |2 |
|2 |R417409972|43 |5 |
|3 |R492849777|30 |1 |
|4 |R522445347|17 |2 |
|5 |R665985398|12 |4 |
|6 |R764750298|29 |8 |
|7 |R956336961|54 |2 |
| Tanggal : 29/05/2012 |
|6 |R236929693|5 |1 |
|7 |R417409972|4 |2 |
|8 |R492849777|2 |1 |
|9 |R522445347|3 |1 |
|10 |R665985398|7 |1 |
|11 |R764750298|6 |1 |
|12 |R956336961|3 |1 |
| Tanggal : 30/05/2012 |
dan seterusnya ...

coding yg telah sy buat kayak gini ...
require_once( '../opendb.php' );
$pilih = 'select * from tb_mem';
$loop = mysql_query( $pilih );
$no=1;
while($data=mysql_fetch_array($loop)) {
echo '<table>';
echo '<tr>';
echo 	'<td>'.'No. : '.$no.'</td>';
echo 	'<td>'.'Members ID : '.$data['mem_id'].'</td>';
echo 	'<td>'.'Jumlah Ambil : '.$data['ambil'].'</td>';
echo 	'<td>'.'Jumlah Terjual : '.$data['jual'].'</td>';
echo '</tr>';
echo '</table>';
$no++;
}
mysql_free_result( $loop);
?>

Mohon bantuannya mas ...
Silahkan login untuk menjawab!
0
Loading...
Fery Ardiant · Aug 19, 2012 · 0 Suka · 0 Tidak Suka
kalo gini gimana?
<?php
require_once( '../opendb.php' );
$pilih 	= 'select * from tb_mem';
$loop 	= mysql_query( $pilih );
$no	= 1;

echo '<table><thead>';
echo '<tr>';
echo '<td>No.</td>';
echo '<td>Members ID</td>';
echo '<td>Jumlah Ambil</td>';
echo '<td>Jumlah Terjual</td>';
echo '</tr>';
echo '</thead><tbody>';
while( $data = mysql_fetch_array( $loop ) )
{
	echo '<tr>';
	echo '<td>'.$no.'</td>';
	echo '<td>'.$data['mem_id'].'</td>';
	echo '<td>'.$data['ambil'].'</td>';
	echo '<td>'.$data['jual'].'</td>';
	echo '</tr>';
	$no++;
}
echo '</tbody></table>';
mysql_free_result( $loop);
?>
0
Loading...
Bella · Aug 19, 2012 · 0 Suka · 0 Tidak Suka
@mas Fery :
kalau dari tabel membernya kan kayak gini mas ..
|tgl |mem_id |ambil|jual|
|29/05/2012|R236929693|10 |2 |
|29/05/2012|R417409972|43 |5 |
|29/05/2012|R492849777|30 |1 |
|29/05/2012|R522445347|17 |2 |
|29/05/2012|R665985398|12 |4 |
|29/05/2012|R764750298|29 |8 |
|29/05/2012|R956336961|54 |2 |
|30/05/2012|R236929693|5 |1 |
|30/05/2012|R417409972|4 |2 |
|30/05/2012|R492849777|2 |1 |
|30/05/2012|R522445347|3 |1 |
|30/05/2012|R665985398|7 |1 |
|30/05/2012|R764750298|6 |1 |
|30/05/2012|R956336961|3 |1 |
|31/05/2012|R236929693|20 |4 |
|31/05/2012|R417409972|35 |1 |
|31/05/2012|R492849777|15 |1 |
|31/05/2012|R522445347|20 |1 |
|31/05/2012|R665985398|5 |1 |
|31/05/2012|R764750298|10 |1 |
|31/05/2012|R956336961|20 |1 |

tanggal 29/05/2012 s/d 31/05/2012 itu kan ada 7 record,
tapi sy pengen tampilan laporannya kayak gini mas ..

==============================
|No.|Members ID|Ambil|Terjual|
==============================
|1 |R236929693|10 |2 |
|2 |R417409972|43 |5 |
|3 |R492849777|30 |1 |
|4 |R522445347|17 |2 |
|5 |R665985398|12 |4 |
|6 |R764750298|29 |8 |
|7 |R956336961|54 |2 |
| Tanggal : 29/05/2012 |
dan seterusnya untuk (tanggal 30 s/d 31) kayak gitu juga.
0
Loading...
Visitor · Aug 23, 2012 · 0 Suka · 0 Tidak Suka
require_once( '../opendb.php' );
$pilih = 'select * from tb_mem where tanggal=tanggal';
$loop = mysql_query( $pilih );
$no=1;
while($data=mysql_fetch_array($loop)) {
echo '<table>';
echo '<tr>';
echo '<td>'.'No. : '.$no.'</td>';
echo '<td>'.'Members ID : '.$data.'</td>';
echo '<td>'.'Jumlah Ambil : '.$data.'</td>';
echo '<td>'.'Jumlah Terjual : '.$data.'</td>';
echo '</tr>';
echo '</table>';
$no++;
}
mysql_free_result( $loop);
?>
0
Loading...
Visitor · Aug 23, 2012 · 0 Suka · 0 Tidak Suka
Buat aja sebuah list menu dengan nama tanggal
dan tanggal pada $pilih = 'select * from tb_mem where tanggal=$tanggal';
terima kasih...

By ALFIKRI saya Baru Belajar Mas
0
Loading...
Bella · Aug 25, 2012 · 0 Suka · 0 Tidak Suka
@mas Alfikri: terimakih atas masukkannya,
kalau $pilih = 'select * from tb_mem where tanggal=$tanggal';
bearti laporan tersebut berdasarkan tanggal, disaat kita
akan menampilkan laporan, kita harus menentukan tanggal,bulan dan tahun
terlebih dahulu.
Sendangkan, sy pengen laporan tersebut seperti yg sudah
sy jelas diatas.
mohon penjelasannya dong ... :(
1
Loading...
Ellyx Christian · Sep 2, 2012 · 1 Suka · 0 Tidak Suka
<?php
$query = mysql_query("select mem_id,sum(ambil) as ambil1,sum(jual) as jual1 from tb_mem group by mem_id")
?>
<table>
	<tr>
	<td>No</td>
	<td>Member ID</td>
	<td>Ambil</td>
	<td>Terjual</td>
	</tr>
<?php $i = 1; while($data = mysql_fetch_array($query)){?>
	<tr>
		<td><?php echo $i?></td>
		<td><?php echo $data['mem_id']?></td>
		<td><?php echo $data['ambil1']?></td>
		<td><?php echo $data['jual1']?></td>
	</tr>
<?php 
$i++;
}
$query = mysql_query("select tgl from tb_mem group by tgl");
while($data=mysql_fetch_array($query)){
?>
	<tr>
		<td colspan="4"><?php echo $data['tgl']?></td>
	</tr>
<?php 
	$query2 = mysql_query("select * from tb_mem where tgl ='".$data['tgl']."'");
	while($data2 = mysql_fetch_array($query2)){?>
		<tr>
			<td><?php echo $i?></td>
			<td><?php echo $data2['mem_id']?></td>
			<td><?php echo $data2['ambil1']?></td>
			<td><?php echo $data2['jual1']?></td>
		</tr>
	<?php
	$i++;
	}
}
?>
</table>