mas ellyx cara memberi warna tabelyang benar bagaimana, saya coba utek2 malah hasil y tiap 1 record itu 1 tabel, jadi klo hasil seacrh 5 maka tabel yg ditampilkan ikut 5 jg!
ingin ak hasil dalam 1 tabel mas! tolong pencerahannya.....
ini scrip + db y.
<?php
include("adm/config.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<?php
$tgl=$_POST['tgl'];
$bln=$_POST['bln'];
$thn=$_POST['thn'];
$tgl_brk=$thn."-".$bln."-".$tgl;
$jam_brk=$_POST['jam_berangkat'];
$tujuan=$_POST['tujuan'];
?>
<body>
<table width="429" border="1">
<?php
$color='#FF0000';
$ksg='#00FFFF';
$query=mysql_query("select * from master_order where jam_berangkat='$jam_brk' and tujuan='$tujuan' and tanggal_berangkat='$tgl_brk'");
while ($wow=mysql_fetch_array($query)){
?>
<tr>
<th width="78" scope="col"> </th>
<th width="76" scope="col"> </th>
<th width="84" scope="col"> </th>
<th width="75" scope="col"> </th>
<th width="82" scope="col"> </th>
</tr>
<tr>
<th scope="row" bgcolor="<?php if($wow['kursi']==1 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 1</div></th>
<td bgcolor="<?php if($wow['kursi']==2 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 2 </div></td>
<td> </td>
<td bgcolor="<?php if($wow['kursi']==3 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 3 </div></td>
<td bgcolor="<?php if($wow['kursi']==4 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 4 </div></td>
</tr>
<tr>
<th scope="row" bgcolor="<?php if($wow['kursi']==5 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 5 </div></th>
<td bgcolor="<?php if($wow['kursi']==6 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 6 </div></td>
<td> </td>
<td bgcolor="<?php if($wow['kursi']==7 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 7 </div></td>
<td bgcolor="<?php if($wow['kursi']==8 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 8 </div></td>
</tr>
<tr>
<th scope="row" bgcolor="<?php if($wow['kursi']==9 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 9 </div></th>
<td bgcolor="<?php if($wow['kursi']==10 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 10</div></td>
<td> </td>
<td bgcolor="<?php if($wow['kursi']==11 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 11</div></td>
<td bgcolor="<?php if($wow['kursi']==12 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 12</div></td>
</tr>
<tr>
<th scope="row" bgcolor="<?php if($wow['kursi']==13 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 13</div></th>
<td bgcolor="<?php if($wow['kursi']==14 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 14</div></td>
<td> </td>
<td bgcolor="<?php if($wow['kursi']==15 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 15</div></td>
<td bgcolor="<?php if($wow['kursi']==16 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 16</div></td>
</tr>
<tr>
<th scope="row" bgcolor="<?php if($wow['kursi']==17 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 17</div></th>
<td bgcolor="<?php if($wow['kursi']==18 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 18</div></td>
<td> </td>
<td bgcolor="<?php if($wow['kursi']==19 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 19</div></td>
<td bgcolor="<?php if($wow['kursi']==20 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 20 </div></td>
</tr>
<tr>
<th scope="row" bgcolor="<?php if($wow['kursi']==21 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 21 </div></th>
<td bgcolor="<?php if($wow['kursi']==22 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 22 </div></td>
<td> </td>
<td bgcolor="<?php if($wow['kursi']==23 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 23 </div></td>
<td bgcolor="<?php if($wow['kursi']==24 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 24 </div></td>
</tr>
<tr>
<th scope="row" bgcolor="<?php if($wow['kursi']==25 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 25 </div></th>
<td bgcolor="<?php if($wow['kursi']==26 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 26 </div></td>
<td> </td>
<td bgcolor="<?php if($wow['kursi']==27 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 27 </div></td>
<td bgcolor="<?php if($wow['kursi']==28 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 28 </div></td>
</tr>
<tr>
<th scope="row" bgcolor="<?php if($wow['kursi']==29 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 29 </div></th>
<td bgcolor="<?php if($wow['kursi']==30 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 30 </div></td>
<td> </td>
<td bgcolor="<?php if($wow['kursi']==31 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 31</div></td>
<td bgcolor="<?php if($wow['kursi']==32 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 32 </div></td>
</tr>
<tr>
<th scope="row" > </th>
<td> </td>
<td> </td>
<td colspan="2" rowspan="2"><div align="center">Toilet</div></td>
</tr>
<tr>
<th scope="row" bgcolor="<?php if($wow['kursi']==33 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 33 </div></th>
<td bgcolor="<?php if($wow['kursi']==34 ){ echo $color; }else { echo $ksg; } ?> "><div align="center">Kursi 34 </div></td>
<td> </td>
</tr>
<?php } ?>
</table>
</body>
</html>
-- phpMyAdmin SQL Dump
-- version 2.11.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Waktu pembuatan: 22. Februari 2013 jam 10:38
-- Versi Server: 5.0.45
-- Versi PHP: 5.2.4
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `tiket`
--
CREATE DATABASE `tiket` DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci;
USE `tiket`;
-- --------------------------------------------------------
--
-- Struktur dari tabel `master_order`
--
CREATE TABLE `master_order` (
`id` int(11) NOT NULL,
`nama` varchar(40) collate latin1_general_ci NOT NULL,
`alamat` varchar(60) collate latin1_general_ci NOT NULL,
`kota` varchar(25) collate latin1_general_ci NOT NULL,
`dari` varchar(20) collate latin1_general_ci NOT NULL,
`tujuan` varchar(20) collate latin1_general_ci NOT NULL,
`brk_dari` varchar(20) collate latin1_general_ci NOT NULL,
`kode_bus` varchar(5) collate latin1_general_ci NOT NULL,
`kursi` varchar(3) collate latin1_general_ci NOT NULL,
`tanggal_beli` date NOT NULL,
`tanggal_berangkat` date NOT NULL,
`jam_beli` time NOT NULL,
`jam_berangkat` varchar(6) collate latin1_general_ci NOT NULL,
`tarif` float NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
--
-- Dumping data untuk tabel `master_order`
--
INSERT INTO `master_order` (`id`, `nama`, `alamat`, `kota`, `dari`, `tujuan`, `brk_dari`, `kode_bus`, `kursi`, `tanggal_beli`, `tanggal_berangkat`, `jam_beli`, `jam_berangkat`, `tarif`) VALUES
(16, 'edwin', 'gurah', '', 'Jawa', 'Bali', '', 'B4', '20', '2012-12-16', '2012-12-16', '21:54:03', '16.00', 175000),
(15, 'Banu Setiawan', 'Kediri', '', 'Jawa', 'Bali', '', 'B1', '1', '2012-12-15', '2013-01-03', '22:37:30', '13.00', 150000),
(18, 'santo', 'kediri', '', 'Jawa', 'Bali', '', 'B5', '6', '2012-12-18', '2012-12-18', '19:20:02', '17.00', 170000),
(19, 'tanti', 'kediri', '', 'Jawa', 'Bali', '', 'B1', '20', '2012-12-18', '2012-12-18', '19:20:45', '13.00', 170000),
(20, 'santi susan', 'madiun', '', 'Jawa', 'Bali', '', 'B1', '12', '2012-12-18', '2012-12-18', '19:22:42', '13.00', 170000),
(34, 'gunawan', 'jl. kyai mojo', '', 'Jawa', 'Bali', 'Kediri', 'B1', '1', '2013-01-02', '2013-01-04', '18:09:06', '13.00', 160000),
(32, 'doni damara', 'kediri', '', 'Jawa', 'Bali', '', 'B1', '1', '2013-01-01', '2013-01-01', '07:05:45', '13.00', 160000),
(30, 'brian', 'gianyar', '', 'Bali', 'Jawa', '', 'B1', '1', '2012-12-31', '2013-01-01', '18:17:14', '13.00', 160000),
(33, 'setiawan', 'jl kkohrun kediri', '', 'Jawa', 'Bali', 'Kediri', 'B1', '2', '2013-01-01', '2013-01-01', '08:10:32', '13.00', 160000),
(35, 'banu setia', 'jl pemuda', '', 'Jawa', 'Bali', 'Kediri', 'B1', '1', '2013-01-25', '2013-02-07', '20:35:10', '13.00', 160000),
(36, 'banu setia', 'Jl. Soekarno hatta', '', 'Jawa', 'Bali', 'Kediri', 'B1', '1', '2013-01-26', '2013-02-01', '23:07:31', '13.00', 160000),
(37, 'sds', 'sds', '', 'Jawa', 'Bali', 'Kediri', 'B1', '2', '2013-01-26', '2013-02-01', '23:16:15', '13.00', 160000),
(38, 'sds', 'wretet', 'Tulung Agung', 'Jawa', 'Bali', 'Kediri', 'B1', '3', '2013-01-26', '2013-02-01', '23:17:58', '13.00', 160000),
(39, 'kklk', 'lklklk', 'Jombang', 'Jawa', 'Bali', 'Surabaya', 'B1', '4', '2013-01-26', '2013-02-01', '23:22:44', '13.00', 130000),
(40, 'sasa', 'sasa', 'Tulung Agung', 'Jawa', 'Bali', 'Kediri', 'B1', '6', '2013-02-07', '2013-01-01', '20:53:04', '13.00', 160000),
(41, '3', '3', 'Tulung Agung', 'Jawa', 'Bali', 'Kediri', 'B1', '3', '2013-02-08', '2013-01-01', '05:11:52', '13.00', 160000),
(44, '7', '7', 'Nganjuk', 'Jawa', 'Bali', 'Kediri', 'B1', '7', '2013-02-08', '2013-01-01', '08:57:53', '13.00', 160000),
(45, '8', '8', 'Nganjuk', 'Jawa', 'Bali', 'Kediri', 'B1', '8', '2013-02-08', '2013-01-01', '08:58:26', '13.00', 160000),
(46, '9', '9', 'Kertosono', 'Jawa', 'Bali', 'Kediri', 'B1', '9', '2013-02-08', '2013-01-01', '09:10:37', '13.00', 160000),
(48, '5', '5', 'Tulung Agung', 'Jawa', 'Bali', 'Kediri', 'B1', '5', '2013-02-08', '2013-02-01', '19:45:49', '13.00', 160000);
-- --------------------------------------------------------
--
-- Struktur dari tabel `polling`
--
CREATE TABLE `polling` (
`id` int(7) NOT NULL auto_increment,
`tiket` varchar(15) collate latin1_general_ci NOT NULL,
`perlengkapan` varchar(15) collate latin1_general_ci NOT NULL,
`ketepatan` varchar(15) collate latin1_general_ci NOT NULL,
`sopir` varchar(15) collate latin1_general_ci NOT NULL,
`langganan` varchar(15) collate latin1_general_ci NOT NULL,
`saran` text collate latin1_general_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=6 ;
--
-- Dumping data untuk tabel `polling`
--
INSERT INTO `polling` (`id`, `tiket`, `perlengkapan`, `ketepatan`, `sopir`, `langganan`, `saran`) VALUES
(1, 'baik', 'baik', 'baik', 'tidak', 'tidak', 'djfd'),
(2, 'tidak', 'tidak', 'tidak', 'tidak', 'tidak', 'lsdsfhn iejdjf '),
(3, 'baik', 'baik', 'baik', 'tidak', 'tidak', ''),
(4, 'baik', 'baik', 'baik', 'baik', 'ya', ''),
(5, 'tidak', 'tidak', 'tidak', 'tidak', 'tidak', 'kurang');
-- --------------------------------------------------------
--
-- Struktur dari tabel `temp_order`
--
CREATE TABLE `temp_order` (
`id` int(11) NOT NULL auto_increment,
`nama` varchar(40) collate latin1_general_ci NOT NULL,
`alamat` varchar(60) collate latin1_general_ci NOT NULL,
`kota` varchar(25) collate latin1_general_ci NOT NULL,
`dari` varchar(20) collate latin1_general_ci NOT NULL,
`tujuan` varchar(20) collate latin1_general_ci NOT NULL,
`brk_dari` varchar(20) collate latin1_general_ci NOT NULL,
`kode_bus` varchar(5) collate latin1_general_ci NOT NULL,
`kursi` varchar(3) collate latin1_general_ci NOT NULL,
`tanggal_beli` date NOT NULL,
`tanggal_berangkat` date NOT NULL,
`jam_beli` time NOT NULL,
`jam_berangkat` varchar(6) collate latin1_general_ci NOT NULL,
`tarif` float NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=49 ;
--
-- Dumping data untuk tabel `temp_order`
--
INSERT INTO `temp_order` (`id`, `nama`, `alamat`, `kota`, `dari`, `tujuan`, `brk_dari`, `kode_bus`, `kursi`, `tanggal_beli`, `tanggal_berangkat`, `jam_beli`, `jam_berangkat`, `tarif`) VALUES
(47, 'ttt', 'ttt', 'Mojokerto', 'Jawa', 'Bali', 'Kediri', 'B1', '3', '2013-02-08', '2013-05-01', '19:31:11', '13.00', 160000);
-- --------------------------------------------------------
--
-- Struktur dari tabel `user`
--
CREATE TABLE `user` (
`id` int(2) NOT NULL auto_increment,
`user` varchar(40) collate latin1_general_ci NOT NULL,
`pass` varchar(40) collate latin1_general_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=4 ;
--
-- Dumping data untuk tabel `user`
--
INSERT INTO `user` (`id`, `user`, `pass`) VALUES
(3, 'admin', '21232f297a57a5a743894a0e4a801fc3');