Weird table repeating when displaying mysql results - php

There's nothing wrong with the result itself.
The image should explain itself.
The table basicly is repeating the whole table for each results instead of displaying the results with multiple lines on one table, its doing 1 line on 1 table many times.
Here's the code that involves it-
<?php
$i=0;
while ($i < $num) {
$f1=mysql_result($result,$i,"id");
$f2=mysql_result($result,$i,"date");
$f3=mysql_result($result,$i,"agentclient");
$f4=mysql_result($result,$i,"propertydescription");
$f5=mysql_result($result,$i,"transactiontype");
$f5=mysql_result($result,$i,"applicabledocument");
$f5=mysql_result($result,$i,"received");
$f5=mysql_result($result,$i,"paid");
?>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr valign="bottom" bgcolor="#000000">
<td width="24"><span class="style1b"><strong>No.</strong></span></td>
<td width="105"><span class="style1b"><strong>Date</strong></span></td>
<td width="57"><span class="style1b"><strong>Agent/client</strong></span></td>
<td width="170"><span class="style1b"><strong>Property/Description</strong></span></td>
<td width="199"><span class="style1b"><strong>Transaction type </strong></span></td>
<td width="235"><span class="style1b"><strong>Applicable document </strong></span></td>
<td width="58"><span class="style1b"><strong>Received</strong></span></td>
<td width="58"><span class="style1b"><strong>Paid</strong></span></td>
</tr>
<tr valign="top" bgcolor="#FFFFFF">
<td><?php echo $f1; ?></td>
<td><?php echo $f2; ?></td>
<td><?php echo $f3; ?></td>
<td><?php echo $f4; ?></td>
<td><?php echo $f5; ?></td>
<td><?php echo $f6; ?></td>
<td><?php echo $f7; ?></td>
<td><?php echo $f8; ?></td>
</tr>
</table>
<?php
$i++;
}
?>

There are lots of way to improve this code, but to fix your immediate problem, just take the header row out of the loop:
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr valign="bottom" bgcolor="#000000">
<td width="24"><span class="style1b"><strong>No.</strong></span></td>
<td width="105"><span class="style1b"><strong>Date</strong></span></td>
<td width="57"><span class="style1b"><strong>Agent/client</strong></span></td>
<td width="170"><span class="style1b"><strong>Property/Description</strong></span></td>
<td width="199"><span class="style1b"><strong>Transaction type </strong></span></td>
<td width="235"><span class="style1b"><strong>Applicable document </strong></span></td>
<td width="58"><span class="style1b"><strong>Received</strong></span></td>
<td width="58"><span class="style1b"><strong>Paid</strong></span></td>
</tr>
<?php
$i=0;
while ($i < $num) {
$f1=mysql_result($result,$i,"id");
$f2=mysql_result($result,$i,"date");
$f3=mysql_result($result,$i,"agentclient");
$f4=mysql_result($result,$i,"propertydescription");
$f5=mysql_result($result,$i,"transactiontype");
$f5=mysql_result($result,$i,"applicabledocument");
$f5=mysql_result($result,$i,"received");
$f5=mysql_result($result,$i,"paid");
?>
<tr valign="top" bgcolor="#FFFFFF">
<td><?php echo $f1; ?></td>
<td><?php echo $f2; ?></td>
<td><?php echo $f3; ?></td>
<td><?php echo $f4; ?></td>
<td><?php echo $f5; ?></td>
<td><?php echo $f6; ?></td>
<td><?php echo $f7; ?></td>
<td><?php echo $f8; ?></td>
</tr>
<?php
$i++;
}
?>
</table>

Related

PHP table (Date) dynamic color change based on validity

<div class="table-responsive">
<table id="Well_CAT" class="table table-striped table-bordered">
<thead> <th>Client_Contract_Number</th>
<th>Currently_Using</th>
<th>MBPS_EAM_Number_RIGT</th>
<th>Model_and_Type</th>
<th>LFour_Yearly</th>
<th>Six_Monthly</th>
<th>One_Yearly</th>
<th>One_and_Half_Yearly</th>
<th>Two_Yearly</th>
<th>Two_and_Half_Yearly</th>
<th>Three_Yearly</th>
<th>Three_and_Half_Yearly</th>
<th>Four_Yearly</th>
<th>Remarks</th>
</thead>
<?php
while($rows=mysql_fetch_array($result)){
?><tr>
<td class="exdate"><? echo $rows['Client_Contract_Number']; ?></td>
<td class="exdate"><? echo $rows['Currently_Using']; ?></td>
<td><? echo $rows['MBPS_EAM_Number_RIGT']; ?></td>
<td><? echo $rows['Model_and_Type']; ?></td>
<td><? echo $rows['LFour_Yearly']; ?></td>
<td class="exdate"><? echo $rows['Six_Monthly']; ?></td>
<td class="exdate"><? echo $rows['One_Yearly']; ?></td>
<td class="exdate"><? echo $rows['One_and_Half_Yearly']; ?></td>
<td class="exdate"><? echo $rows['Two_Yearly']; ?></td>
<td class="exdate"><? echo $rows['Two_and_Half_Yearly']; ?></td>
<td class="exdate"><? echo $rows['Three_Yearly']; ?></td>
<td class="exdate"><? echo $rows['Three_and_Half_Yearly']; ?></td>
<td class="exdate"><? echo $rows['Four_Yearly']; ?></td>
<td class="exdate"><? echo $rows['Remarks']; ?></td>
</tr>
<?php
}
?>
</table>
Below is my table, it is to track the validity of certificates, columns from Lfour yearly till Fouryearly are date fields, i would like to conditional color format these fields based on validity... Like If valid - Green, Expired - Red.
Since PHP >= 5.2.0 you can use the DateTime class as such:
if (new DateTime() > new DateTime("2010-05-15 16:00:00")) {
# current time is greater than 2010-05-15 16:00:00
# in other words, 2010-05-15 16:00:00 has passed
}
The string passed to the DateTime constructor is parsed according to these rules.
Here is an example with your code:
<td class="exdate" style="color:<?php echo (new DateTime() > new DateTime($rows['Six_Monthly'])) ? 'red' : 'green'; ?>;" ><? echo $rows['Six_Monthly']; ?></td>

why I cannot Displaying data from view in MySQL database?

I've a view to displaying some data from database to my php program, but the data cannot be displayed when I running it?
this is my view from phpmyadmin look like
(select `m`.`id_mutasi` AS `id_mutasi`,`m`.`tgl_mutasi` AS `tgl_mutasi`,`m`.`kode_barang` AS `kode_barang`,`a`.`nm_barang` AS `nm_barang`,`m`.`ruang_lama` AS `ruang_lama`,`m`.`ruang_baru` AS `ruang_baru`,`u`.`nm_unit` AS `unit_lama`,`m`.`unit_baru` AS `unit_baru`,`i`.`user` AS `user_lama`,`m`.`userbaru` AS `user_baru`,`m`.`jumlah` AS `jumlah`,`m`.`user_posting` AS `user_posting` from ((((((`simaset`.`mutasi` `m` join `simaset`.`inventarisasi` `i` on((`m`.`kode_inventarisasi_baru` = `i`.`kode_inventarisasi`))) join `simaset`.`aset` `a` on((`a`.`kode_barang` = `m`.`kode_barang`))) join `simaset`.`ruangan` `r` on((`r`.`kode_ruangan` = `m`.`ruang_lama`))) join `simaset`.`ruangan` `rb` on((`rb`.`kode_ruangan` = `i`.`kode_ruangan`))) join `simaset`.`unit_kerja` `u` on((`u`.`kode_unit` = `m`.`unit_lama`))) join `simaset`.`unit_kerja` `ub` on((`ub`.`kode_unit` = `i`.`kode_unit`))))
and this is my php code
<table id="table-example" class="table" cellpadding="0" cellspacing="0" border="0">
<thead>
<tr>
<!-- <th>NO</th> -->
<th>ID Mutasi</th>
<th>Tgl Mutasi</th>
<th>Kode Barang</th>
<th>Barang</th>
<th>Dept Lama</th>
<th>Jabatan Lama</th>
<th>Dept Baru</th>
<th>Jabatan Baru</th>
<!-- <th>User Baru</th> -->
<th>Jumlah</th>
<th>User Posting</th>
<!-- <th>User Posting</th> -->
<th>Aksi</th>
</tr>
</thead>
<tbody>
<!-- <?php $no = 1;?> -->
<?php do { ?>
<tr class=gradeX>
<!-- <td><center><?php echo $no++ ?></center></td> -->
<td><center>
<?php echo $row_rs_data['id_mutasi']; ?>
</center></td>
<td><?php echo $row_rs_data['tgl_mutasi']; ?></td>
<td ><?php echo $row_rs_data['kode_barang']; ?></td>
<td ><?php echo $row_rs_data['nm_barang']; ?></td>
<td ><?php echo $row_rs_data['ruanglama']; ?></td>
<td ><?php echo $row_rs_data['unitlama']; ?></td>
<td ><?php echo $row_rs_data['ruangbaru']; ?></td>
<td ><?php echo $row_rs_data['unitbaru']; ?></td>
<!-- <td ><?php echo $row_rs_data['userbaru']; ?></td> -->
<td ><center><?php echo $row_rs_data['jumlah']; ?></center></td>
<td ><?php echo $row_rs_data['user_posting']; ?></td>
<td ><img src="img/icons/packs/silk/16x16/cross.png" width="16" height="16" alt="Hapus" title="Hapus" /></td>
</tr>
<?php
echo "test";
} while ($row_rs_data = mysql_fetch_assoc($rs_data)); ?>
</tbody>
</table>
Replace your <tbody> block. Use while instead of do..while and mysqli instead of mysql mysql has been deprecated.
<tbody>
<?php while ($row_rs_data = mysql_fetch_assoc($rs_data)){ ?>
<tr class=gradeX>
<!-- <td><center><?php echo $no++ ?></center></td> -->
<td><center>
<?php echo $row_rs_data['id_mutasi']; ?>
</center></td>
<td><?php echo $row_rs_data['tgl_mutasi']; ?></td>
<td ><?php echo $row_rs_data['kode_barang']; ?></td>
<td ><?php echo $row_rs_data['nm_barang']; ?></td>
<td ><?php echo $row_rs_data['ruanglama']; ?></td>
<td ><?php echo $row_rs_data['unitlama']; ?></td>
<td ><?php echo $row_rs_data['ruangbaru']; ?></td>
<td ><?php echo $row_rs_data['unitbaru']; ?></td>
<!-- <td ><?php echo $row_rs_data['userbaru']; ?></td> -->
<td ><center><?php echo $row_rs_data['jumlah']; ?></center></td>
<td ><?php echo $row_rs_data['user_posting']; ?></td>
<td ><img src="img/icons/packs/silk/16x16/cross.png" width="16" height="16" alt="Hapus" title="Hapus" /></td>
</tr>
<?php
echo "test";
} ?>
</tbody>

Need to this table with 100 rows and assign a valor to the code PHP

I need to solve this simple thing:
Got this code:
<?php
$xml=simplexml_load_file("d2ladder.xml") or die("Error: Cannot create object");
?>
<table width="100%" border="1" cellspacing="0" cellpadding="2" align="center" style="text-align:center">
<tbody>
<tr class="<?php if ($xml->ladder[12]->char[0]->status == "alive") { echo "alive"; } else { echo "dead"; } ?>">
<td width="10%">1.</td>
<td width="50%" style="text-align:left"><?php echo $xml->ladder[12]->char[0]->prefix; ?> <?php echo $xml->ladder[12]->char[0]->name; ?></td>
<td width="10%"><?php echo $xml->ladder[12]->char[0]->class; ?></td>
<td width="10%"><?php echo $xml->ladder[12]->char[0]->level; ?></td>
<td width="20%"><?php echo $xml->ladder[12]->char[0]->experience; ?></td>
</tr>
<tr class="<?php if ($xml->ladder[12]->char[1]->status == "alive") { echo "alive"; } else { echo "dead"; } ?>">
<td width="10%">2.</td>
<td width="50%" style="text-align:left"><?php echo $xml->ladder[12]->char[1]->prefix; ?> <?php echo $xml->ladder[12]->char[1]->name; ?></td>
<td width="10%"><?php echo $xml->ladder[12]->char[1]->class; ?></td>
<td width="10%"><?php echo $xml->ladder[12]->char[1]->level; ?></td>
<td width="20%"><?php echo $xml->ladder[12]->char[1]->experience; ?></td>
</tr>
</tbody>
</table>
Need to create rows on this table till char[99]
Maybe I need to use while? Because sometimes it wont get to 99 on the sitemap
Use for/while cycle:
for ($i = 0; $i < 100; $i++) {
?>
<tr class="<?php if ($xml->ladder[12]->char[$i]->status == "alive") { echo "alive"; } else { echo "dead"; } ?>">
<td width="10%"><?php echo $i; ?>.</td>
<td width="50%" style="text-align:left"><?php echo $xml->ladder[12]->char[$i]->prefix; ?> <?php echo $xml->ladder[12]->char[$i]->name; ?></td>
<td width="10%"><?php echo $xml->ladder[12]->char[$i]->class; ?></td>
<td width="10%"><?php echo $xml->ladder[12]->char[$i]->level; ?></td>
<td width="20%"><?php echo $xml->ladder[12]->char[$i]->experience; ?></td>
</tr>
<?php }
See for cycle
Hope this helps.

How to do formatting using CSS to table

I am trying to design the table but it seems coming into proper way but for some cases. In this table, that $cal_amount and $cal_amount_key part shouldbe print whole for any numbers of cars.
Code:
PHP
<?php
$TotV=array("car","bus","jeep");
$Nopkg=array(759,159,459);
$Avg=array(20,50,15);
$Qty=array(15000,58000,58922);
$rate=array(31.73,17.15,17.25);
$gro_tot=789456;
$Cex=781254;
$S_Tot=159254;
$Vat=12500;
$frieght=0;
$G_Tot=985251;
?>
CSS
table,td,th,tr {
border:1px solid black;
border-collapse: collapse;
text-align:left;
}
HTML
<table>
<tr>
<th>S.No</th><th align="center">Variety of Goods</th><th style="width:70px">No.and Description of<br/>Packages</th><th style="width:70px">Avg. Contents per Package<br/>(Pcs)</th><th style="width:70px">Total Quantity<br/>(Pcs)</th><th style="width:70px">Rate per pc.</th><th colspan="2" style="text-align:center;">Amount<br/>(Rs.)</th>
</tr>
<?php
for($i=0;$i<count($TotV);$i++)
{?>
<tr>
<td><?php echo $i+1;?></td>
<td><?php echo strtoupper($TotV[$i]);?></td>
<td><?php echo $Nopkg[$i];?></td>
<td><?php echo $Avg[$i];?></td>
<td><?php echo $Qty[$i];?></td>
<td><?php echo $rate[$i];?></td>
<?php
}?>
<td colspan="1">Total Value</td><td style="width:100px;text-align:right;"> <?php echo $gro_tot;?></td>
<tr><td></td><td></td>
<td></td><td></td><td></td><td></td><td style="width:150px;">C.Ex.Duty 12.5%</td><td style="width:150px;text-align:right;"> <?php echo $Cex;?></td></tr>
<tr><td></td><td></td><td></td><td></td><td></td><td></td></td><td style="width:150px;">SubTotal</td><td id="num" style="width:150px;text-align:right;"> <?php echo $S_Tot;?></td></tr>
<tr><td></td><td></td><td></td><td></td><td></td><td></td><td style="width:150px;">VAT/CST 2%</td><td style="width:150px;text-align:right;"> <?php echo $Vat;?></td></tr>
<tr><td style="border:none;" colspan="3"><b>qwert</b></td><td style="border:none;"></td><td style="border:none;" colspan="2"><td><b>Freight</b></td><td style="width:150px;text-align:right;"> <STRONG><?php echo $frieght;?></STRONG></td></tr>
<tr><td style="border:none;" colspan="3"><b>asdf</b></td><td style="border:none;"></td><td style="border:none;" colspan="2"><td><b>Grand Total</b></td><td style="width:150px;text-align:right;"> <STRONG><?php echo $G_Tot;?></STRONG></td></tr>
</tr>
</table>
Please suggest some changes to be done in code so that It will start from first row instead of third row. Thanks in advance.
Try this:
First make PHP array for total calculation and label.
$TotV=array("car","bus","jeep");
$Nopkg=array(759,159,459);
$Avg=array(20,50,15);
$Qty=array(15000,58000,58922);
$rate=array(31.73,17.15,17.25);
$gro_tot=789456;
$Cex=781254;
$S_Tot=159254;
$Vat=12500;
$frieght=0;
$G_Tot=985251;
$cal_amount_key = array('Total Value',
'C.Ex.Duty 12.5%',
'SubTotal',
'VAT/CST 2%',
'Freight',
'Grand Total');
$cal_amount = array($gro_tot,
$Cex,
$S_Tot,
$Vat,
$frieght,
$G_Tot);
Put the code inside loop:
<table>
<tr>
<th>S.No</th>
<th align="center">Variety of Goods</th>
<th style="width:70px">No.and Description of<br/>Packages</th>
<th style="width:70px">Avg. Contents per Package<br/>(Pcs)</th>
<th style="width:70px">Total Quantity<br/>(Pcs)</th>
<th style="width:70px">Rate per pc.</th>
<th colspan="2" style="text-align:center;">Amount<br/>(Rs.)</th>
</tr>
<?php
for($i=0;$i<count($TotV);$i++) {?>
<tr>
<td><?php echo $i+1;?></td>
<td><?php echo strtoupper($TotV[$i]);?></td>
<td><?php echo $Nopkg[$i];?></td>
<td><?php echo $Avg[$i];?></td>
<td><?php echo $Qty[$i];?></td>
<td><?php echo $rate[$i];?></td>
<td><?php echo $cal_amount_key[$i];?></td>
<td style="width:100px;text-align:right;"><?php echo $cal_amount[$i];?></td>
</tr>
<?php } ?>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td style="width:150px;">VAT/CST 2%</td>
<td style="width:150px;text-align:right;"> <?php echo $Vat;?></td>
</tr>
<tr>
<td style="border:none;" colspan="3"><b>qwert</b></td>
<td style="border:none;"></td>
<td style="border:none;" colspan="2">
<td><b>Freight</b></td>
<td style="width:150px;text-align:right;"> <STRONG><?php echo $frieght;?></STRONG></td>
</tr>
<tr>
<td style="border:none;" colspan="3"><b>asdf</b></td>
<td style="border:none;"></td>
<td style="border:none;" colspan="2">
<td><b>Grand Total</b></td>
<td style="width:150px;text-align:right;"> <STRONG><?php echo $G_Tot;?></STRONG></td>
</tr>
</table>

my php code returns to many tables

I have a database with 3 tables and 6 to 20 rows in each, but my PHP code creates 8 tables when there should be only 2 (2 post in the DB)
But why does it do that, I took the code from a different PHP page, where it works fine?
<?php
session_start();
require_once("connect.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>
<title>Brand check</title>
</head>
<body>
<br />
<br />
<?php
$query = mysql_query("SELECT * FROM under_etage, sal_1, sal_2") or die(mysql_error());
while($row = mysql_fetch_array($query)) {
?>
<table width="1100" border="0" align="center" cellpadding="0" cellspacing="0"lass="bold_font">
<tr>
<td width="150" height="25" class="info"> <?php echo $row["etDate"]; ?></td>
<td width="100" height="25" class="info"> Lys</td>
<td width="100" height="25" class="info"> Skilt</td>
<td width="100" class="info" > Brandtæppe</td>
<td width="100" class="info"> Brand sprøjte</td>
<td width="500" class="info"> Døre</td>
</tr>
<tr>
<td height="20" class="split">Underetage</td>
<td width="50" class="split"> </td>
<td class="split"> </td>
<td class="split"> </td>
<td class="split"> </td>
<td class="split"> </td>
</tr>
<tr>
<td class="sort_bar">Opgang A</td>
<td width="50" height="25" class="info" ><?php echo $row["lys_u_a"]; ?></td>
<td class="info"><?php echo $row["skilt_u_a"]; ?></td>
<td class="info"> </td>
<td class="info"> </td>
<td class="info"><?php echo $row["door_u_a"]; ?></td>
</tr>
<tr>
<td height="25" class="sort_bar">Studie/gang</td>
<td width="50" height="25" class="info"><?php echo $row["lys_u_s"]; ?></td>
<td class="info"><?php echo $row["skilt_u_s"]; ?></td>
<td class="info"> </td>
<td class="info"> </td>
<td class="info"><?php echo $row["door_u_s"]; ?></td>
</tr>
<tr>
<td height="25" class="sort_bar">Opgang B</td>
<td width="50" height="25" class="info"><?php echo $row["lys_u_b"]; ?></td>
<td class="info"><?php echo $row["skilt_u_b"]; ?></td>
<td class="info"> </td>
<td class="info"> </td>
<td class="info"><?php echo $row["door_u_b"]; ?> </td>
</tr>
<tr>
<td height="25" class="sort_bar">Bar - Festrum</td>
<td width="50" height="25" class="info"><?php echo $row["lys_u_bar"]; ?></td>
<td class="info"><?php echo $row["skilt_u_bar"]; ?></td>
<td class="info"> </td>
<td class="info"> </td>
<td class="info"> </td>
</tr>
<tr>
<td height="25" class="sort_bar">Opgang C</td>
<td width="50" height="25" class="info"><?php echo $row["lys_u_c"]; ?></td>
<td class="info"><?php echo $row["skilt_u_c"]; ?></td>
<td class="info"> </td>
<td class="info"> </td>
<td class="info"><?php echo $row["door_u_c"]; ?> </td>
</tr>
<tr>
<td height="25" class="sort_bar">Opgang D</td>
<td width="50" height="25" class="info"><?php echo $row["lys_u_d"]; ?></td>
<td class="info"><?php echo $row["skilt_u_d"]; ?></td>
<td class="info"> </td>
<td class="info"> </td>
<td class="info"><?php echo $row["door_u_d"]; ?> </td>
</tr>
<tr>
<td height="20" class="split">Etager</td>
<td width="50" class="split"> </td>
<td class="split"> </td>
<td class="split"> </td>
<td class="split"> </td>
<td class="split"> </td>
</tr>
<tr>
<td class="grey_bar">1. Sal A</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_1a"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_1a"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_1a"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_1a"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_1a"]; ?></td>
</tr>
<tr>
<td class="grey_bar">1. Sal B</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_1b"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_1b"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_1b"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_1b"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_1b"]; ?></td>
</tr>
<tr>
<td class="grey_bar">1. Sal C</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_1c"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_1c"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_1c"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_1c"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_1c"]; ?></td>
</tr>
<tr>
<td class="grey_bar">1. Sal D</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_1d"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_1d"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_1d"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_1d"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_1d"]; ?></td>
</tr>
<tr>
<td height="25" class="sort_bar">2. Sal A</td>
<td width="50" height="25" class="info"><?php echo $row["lys_2a"]; ?></td>
<td class="info"><?php echo $row["skilt_2a"]; ?></td>
<td class="info"><?php echo $row["bt_2a"]; ?></td>
<td class="info"><?php echo $row["bs_2a"]; ?></td>
<td class="info"><?php echo $row["doors_2a"]; ?></td>
</tr>
<tr>
<td height="25" class="sort_bar">2. Sal B</td>
<td width="50" height="25" class="info"><?php echo $row["lys_2b"]; ?></td>
<td class="info"><?php echo $row["skilt_2b"]; ?></td>
<td class="info"><?php echo $row["bt_2b"]; ?></td>
<td class="info"><?php echo $row["bs_2b"]; ?></td>
<td class="info"><?php echo $row["doors_2b"]; ?></td>
</tr>
<tr>
<td height="25" class="sort_bar">2. Sal C</td>
<td width="50" height="25" class="info"><?php echo $row["lys_2c"]; ?></td>
<td class="info"><?php echo $row["skilt_2c"]; ?></td>
<td class="info"><?php echo $row["bt_2c"]; ?></td>
<td class="info"><?php echo $row["bs_2c"]; ?></td>
<td class="info"><?php echo $row["doors_2c"]; ?></td>
</tr>
<tr>
<td height="25" class="sort_bar">2. Sal D</td>
<td width="50" height="25" class="info"><?php echo $row["lys_2d"]; ?></td>
<td class="info"><?php echo $row["skilt_2d"]; ?></td>
<td class="info"><?php echo $row["bt_2d"]; ?></td>
<td class="info"><?php echo $row["bs_2d"]; ?></td>
<td class="info"><?php echo $row["doors_2d"]; ?></td>
</tr>
<tr>
<td class="grey_bar">3. Sal A</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_3a"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_3a"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_3a"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_3a"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_3a"]; ?></td>
</tr>
<tr>
<td class="grey_bar">3. Sal B</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_3b"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_3b"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_3b"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_3b"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_3b"]; ?></td>
</tr>
<tr>
<td class="grey_bar">3. Sal C</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_3c"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_3c"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_3c"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_3c"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_3c"]; ?></td>
</tr>
<tr>
<td class="grey_bar">3. Sal D</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_3d"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_3d"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_3d"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_3d"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_3d"]; ?></td>
</tr>
<tr>
<td height="25" class="sort_bar">4. Sal A</td>
<td width="50" height="25" class="info"><?php echo $row["lys_4a"]; ?></td>
<td class="info"><?php echo $row["skilt_4a"]; ?></td>
<td class="info"><?php echo $row["bt_4a"]; ?></td>
<td class="info"><?php echo $row["bs_4a"]; ?></td>
<td class="info"><?php echo $row["doors_4a"]; ?> </td>
</tr>
<tr>
<td height="25" class="sort_bar">4. Sal B</td>
<td width="50" height="25" class="info"><?php echo $row["lys_4b"]; ?></td>
<td class="info"><?php echo $row["skilt_4b"]; ?></td>
<td class="info"><?php echo $row["bt_4b"]; ?></td>
<td class="info"><?php echo $row["bs_4b"]; ?></td>
<td class="info"><?php echo $row["doors_4b"]; ?> </td>
</tr>
<tr>
<td height="25" class="sort_bar">4. Sal C</td>
<td width="50" height="25" class="info"><?php echo $row["lys_4c"]; ?></td>
<td class="info"><?php echo $row["skilt_4c"]; ?></td>
<td class="info"><?php echo $row["bt_4c"]; ?></td>
<td class="info"><?php echo $row["bs_4c"]; ?></td>
<td class="info"><?php echo $row["doors_4c"]; ?> </td>
</tr>
<tr>
<td height="25" class="sort_bar">4. Sal D</td>
<td width="50" height="25" class="info"><?php echo $row["lys_4d"]; ?></td>
<td class="info"><?php echo $row["skilt_4d"]; ?></td>
<td class="info"><?php echo $row["bt_4d"]; ?></td>
<td class="info"><?php echo $row["bs_4d"]; ?></td>
<td class="info"><?php echo $row["doors_4d"]; ?> </td>
</tr>
<tr>
<td class="grey_bar">5. Sal A</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_5a"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_5a"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_5a"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_5a"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_5a"]; ?></td>
</tr>
<tr>
<td class="grey_bar">5. Sal B</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_5b"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_5b"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_5b"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_5b"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_5b"]; ?></td>
</tr>
<tr>
<td class="grey_bar">5. Sal C</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_5c"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_5c"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_5c"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_5c"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_5c"]; ?></td>
</tr>
<tr>
<td class="grey_bar">5. Sal D</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_5d"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_5d"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_5d"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_5d"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_5d"]; ?></td>
</tr>
<tr>
<td height="25" class="sort_bar">6. Sal A</td>
<td width="50" height="25" class="info"><?php echo $row["lys_6a"]; ?></td>
<td class="info"><?php echo $row["skilt_6a"]; ?></td>
<td class="info"><?php echo $row["bt_6a"]; ?></td>
<td class="info"><?php echo $row["bs_6a"]; ?></td>
<td class="info"><?php echo $row["doors_6a"]; ?> </td>
</tr>
<tr>
<td height="25" class="sort_bar">6. Sal B</td>
<td width="50" height="25" class="info"><?php echo $row["lys_6b"]; ?></td>
<td class="info"><?php echo $row["skilt_6b"]; ?></td>
<td class="info"><?php echo $row["bt_6b"]; ?></td>
<td class="info"><?php echo $row["bs_6b"]; ?></td>
<td class="info"><?php echo $row["doors_6b"]; ?> </td>
</tr>
<tr>
<td height="25" class="sort_bar">6. Sal C</td>
<td width="50" height="25" class="info"><?php echo $row["lys_6c"]; ?></td>
<td class="info"><?php echo $row["skilt_6c"]; ?></td>
<td class="info"><?php echo $row["bt_6c"]; ?></td>
<td class="info"><?php echo $row["bs_6c"]; ?></td>
<td class="info"><?php echo $row["doors_6c"]; ?> </td>
</tr >
<tr>
<td height="25" class="sort_bar">6. Sal D</td>
<td width="50" height="25" class="info"><?php echo $row["lys_6d"]; ?></td>
<td class="info"><?php echo $row["skilt_6d"]; ?></td>
<td class="info"><?php echo $row["bt_6d"]; ?></td>
<td class="info"><?php echo $row["bs_6d"]; ?></td>
<td class="info"><?php echo $row["doors_6d"]; ?> </td>
</tr>
<tr>
<td height="25" class="grey_bar">7. Sal A</td>
<td width="50" height="25" class="grey_bar"><?php echo $row["lys_7a"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_7a"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_7a"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_7a"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_7a"]; ?> </td>
</tr>
<tr>
<td height="25" class="grey_bar">7. Sal B</td>
<td width="50" height="25" class="grey_bar"><?php echo $row["lys_7b"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_7b"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_7b"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_7b"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_7b"]; ?> </td>
</tr>
<tr>
<td height="25" class="grey_bar">7. Sal C</td>
<td width="50" height="25" class="grey_bar"><?php echo $row["lys_7c"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_7c"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_7c"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_7c"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_7c"]; ?> </td>
</tr>
<tr>
<td height="25" class="grey_bar">7. Sal D</td>
<td width="50" height="25" class="grey_bar"><?php echo $row["lys_7d"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_7d"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_7d"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_7d"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_7d"]; ?> </td>
</tr>
<tr>
<td height="20" class="split">Taget</td>
<td width="50" class="split"> </td>
<td class="split"> </td>
<td class="split"> </td>
<td class="split"> </td>
<td class="split"> </td>
</tr>
<tr>
<td height="14" class="sort_bar">Taget</td>
<td width="50" height="25" class="info" ><?php echo $row["lys_t"]; ?></td>
<td class="info"><?php echo $row["skilt_t"]; ?></td>
<td class="info"></td>
<td class="info"><?php echo $row["brand_s_t"]; ?></td>
<td class="info"><?php echo $row["door_t"]; ?></td>
</tr>
</table>
<br />
<?php } ?>
</body>
</html>
Follow this example and use your data trust me it will work
// set up your query within a variable to make it easier to work with
$query = "SELECT * FROM people";
$result = mysql_query($query); //this will conect to the database and select the table to run the query on and return the values from that table.
// now we will set up a while loop to retrieve the information from the database table.
while ($person = mysql_fetch_array($result)) {
echo "<h3>". $person['name'] ."</h3>"; // this line will fetch the query result that is stored in the $person variable and find the row ['name'] and display it on screen
echo "<p>". $person['info'] ."</p>";
}
?>
what if you broke the query into sections so the first query selected * from the one table and the next query selected data the other table then pass both variables thru the mysql_fetch_array($query1, $query2)

Categories