I am trying to populate modals with data from mysql database, relating to the card that the user clicks on. The cards are generated by while loop - example below.
Right now my modal only shows the data relating to the first row of the database, no matter which card you click on. What is the easiest why to tie the card data to the modal?
<?php
$result = $conn->query($query);
if (!$result){
echo $conn->error;
}else{
while($row = $result->fetch_assoc()){
if ($row["size"]=='XLarge'){
echo "<div class='col-4 col padding-small'>
<div class='card' style='width: 100%'>
<div class='card-body'>
<h4 class='mybreed'>{$row["breed"]}</h4>
<h5 class='card-subtitle'>Category: {$row["category"]}</h5>
<div class='row flex-spaces child-borders'>
<label class='paper-btn margin' for='modal-2' onclick='modal-2'>Learn about me!</label>
</div>
<img class='image-bottom' style='width: 100%' src='{$row["image"]}'
alt='No image available'>
</div>
</div>
</div>";
echo "<input class='modal-state' id='modal-2' type='checkbox'>
<div class='modal'>
<label class='modal-bg' for='modal-2'></label>
<div class='modal-body'>
<label class='btn-close' for='modal-2'>X</label>
<h4 class='modal-title'>Factfile: {$row["breed"]}</h4>
<p class='modal-text'>
<table>
<tbody>
<tr>
<td>Category:</td>
<td>{$row["category"]}</td>
</tr>
<tr>
<td>Intelligence:</td>
<td>{$row["intelligence_category"]}</td>
</tr>
<tr>
<td>Intelligence Rank:</td>
<td># {$row["intelligence_rank"]}</td>
</tr>
<tr>
<td>Average Lifespan:</td>
<td>{$row["average_lifespan"]} years</td>
</tr>
<tr>
<td>Average Shoulder Height & Weight:</td>
<td>{$row["shoulder_height_cm"]} cm / {$row["weight_kg"]} kg</td>
</tr>
<tr>
<td>Suitability for children:</td>
<td>{$row["suitability_for_children"]}</td>
</tr>
<tr>
<td>Known Health Problems:</td>
<td>{$row["genetic_diseases"]}</td>
</tr>
<tr>
<td>Cost of Ownership:</td>
<td>{$row["price_bracket"]}</td>
</tr>
</tbody>
</table>
</p>
</div>
</div>";
}
}
}
$result->close();
?>
Related
I have popup it works normal i need to use method post to get my value from the input balise but the problem is when i do form the popup window displays in just a second then hide again and I need to click two time becausethe first time i got just the last result
<div class="List_modify">
<table class="list">
<thead class="topBar">
<tr>
<th>Prenom</th>
<th>Nom</th>
<th>CIN</th>
<th>Emails</th>
<th>Références</th>
<th>Photos</th>
<th>Niveau</th>
<th class="button_editer" style="vertical-align:middle"><span>Editer</span></th>
</tr>
</thead>
<?php $requet = "select * from Etudiants";
$resultat = mysqli_query($connecte, $requet);
while ($r = mysqli_fetch_array($resultat)) {
?>
<tbody class="container">
<tr>
<td>
<?php echo $r['Prenom']; ?>
</td>
<td>
<?php echo $r['Nom']; ?>
</td>
<td>
<?php echo $r['CIN']; ?>
</td>
<td>
<?php echo $r['Emails']; ?>
</td>
<td>
<?php echo $r['Matricule']; ?>
</td>
<td> <img src="image/<?php echo $r['Photo']; ?> " style="width: 150px; height:150px;"></td>
<td>
<?php echo $r['Niveau']; ?> </td>
<td>
<form method="POST" action="">
<input type="hidden" name="id" value="<?php echo $r['Id_Etudiant']; ?>">
<button class=" button" onclick="show()" style="vertical-align:middle" type="submit" name="submit"><span>Editer<i class=" fas fa-user-edit"></i></span>
</button>
</form>
</td>
</tr>
</tbody>
<?php } ?>
</table>
</div>
<div class="background_page_modify" id="page_modify" onclick="hide()">
<div class="page_etudiant" onclick="event.stopPropagation()">
<div class="closebtn" id="closebtn" onclick="hide()">
<div class="circle"> +</div>
</div>
<div class="etudiant_box">
<?php
if (isset($_REQUEST['submit'])) {
$checkid = $_REQUEST['id'];
echo $checkid;
}
?>
</div>
</div>
</div>
I have a table reading out a few columns of a db, with an edit button in each row. All I am trying to do is, when the edit button is clicked, that row is displayed with all of its columns in another page. Any help would be great. I know it's simple, but I can get it to work. I am able to navigate to the next page, but not sure how to carry the id of the specific row and read that out. Thanks.
index. php
<form id="mainform" action="editFunding2.php">
<div class='row'>
<div class='col-12'>
<div class='table table-responsive'>
<table class='table table-striped table-bordered datatable active' id='grantTable'>
<thead>
<tr>
<th>FP ID</th>
<th>Short Title</th>
<th>PI</th>
<th>Department</th>
<th>Funding Type</th>
<th>Change Funding Type</th>
</tr>
</thead>
<tbody>
<?php
//Foreach loop iterates through each column of $getallrows function
foreach($allRows as $rowID => $rowInfo){ ?>
<tr>
<td><?php echo $rowInfo['fpID'];?></td>
<td><?php echo $rowInfo['shortTitle'];?></td>
<td><?php echo $rowInfo['PI'];?></td>
<td><?php echo $rowInfo['Department'];?></td>
<td><?php echo $rowInfo['fundingType'];?></td>
<!--Create dynamic id -->
<?php $rdDrop = "ddgrantType_".$rowInfo['fpID'];?>
<td>
<button type="submit" class="btn btn-danger" name="action" value='Change Funding Type'>Change Funding</button>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</form>
My editFunding2.php page
<div class='row'>
<div class='col-12'>
<div class='table table-responsive'>
<table class='table table-striped table-bordered datatable active' id='grantTable'>
<thead>
<tr>
<th>FP ID</th>
<th>Short Title</th>
<th>PI</th>
<th>Department</th>
<th>Division</th>
<th>Sponsor Name</th>
<th>Project Start</th>
<th>Project End</th>
<th>Funding Type</th>
<th>Yes/No</th>
<th>Proper Type If No</th>
<!-- <th>Exclusions</th>
<th>FP Durtation</th> -->
<th>Comment</th>
</tr>
</thead>
<tbody>
<?php
session_start();
$editRow = $_REQUEST['fpID'];
$mssql = mysqli_query("SELECT * FROM spacing.METADATA_WEBFORM WHERE FUNDING_PROPOSAL_ID = $fpID' ") or die (mysqli_error());
while($rowInfo = mysqli_fetch_array($mssql)) {
?>
<tr>
<td><?php echo $rowInfo['fpID'];?></td>
<td><?php echo $rowInfo['shortTitle'];?></td>
<td><?php echo $rowInfo['PI'];?></td>
<td><?php echo $rowInfo['Department'];?></td>
<td><?php echo $rowInfo['Division'];?></td>
<td><?php echo $rowInfo['sponsorName'];?></td>
<td><?php echo $rowInfo['Date_Project_Start']->format('Y-m-d');?></td>
<td><?php echo $rowInfo['Date_Project_End']->format('Y-m-d');?></td>
<td><?php echo $rowInfo['fundingType'];?></td>
<?php } ?>
<!--Create dynamic id -->
<?php $rdDrop = "ddgrantType_".$rowInfo['fpID'];?>
<td>
<div class="form-check">
<label class="form-check-label">
<input type="radio" class='form-check-input' name="rdGrant[<?php echo $rowInfo['fpID'];?>]" value="Yes" id="rdYes" onclick="disable('<?php echo $rdDrop;?>')" checked/> Yes
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input class='form-check-input' type="radio" name="rdGrant[<?php echo $rowInfo['fpID'];?>]" value="No" id="rdNo" onclick="enable('<?php echo $rdDrop;?>')"/> No
</label>
</div>
</td>
<td>
<div class="dropdown">
<select class='form-control' name="ddgrantGroup[<?php echo $rowInfo['fpID'];?>]" id="<?php echo $rdDrop;?>" disabled>
<option value=''>Select Proper Funding Type</option>
<option value="Corporate Sponsor">Corporate Sponsor</option>
<option value="Federal">Federal</option>
<option value="Foundation Selected">Foundation Selected</option>
<option value="Internally Funded">Internally Funded</option>
<option value="State/Local">State/Local</option>
</select>
</div>
</td>
<td>
<div class="comment">
<textarea class="form-control" aria-label="With textarea" name="grantComment[<?php echo $rowInfo['fpID'];?>]" id="grantComment" placeholder="Comments"></textarea>
</div>
</td>
</tr>
</tbody>
</div>
</div>
</div>
<div class='row'>
<div class='col-12 text-right'>
<button type="submit" class="btn btn-secondary formsubmitbttn" name="action" value='save'>Save</button>
<button type="submit" class="btn btn-primary formsubmitbttn" name="action" value='complete'>Complete and Save</button>
</div>
</div>
</div>
Change your button to a
My Link to xx
In editFunding2.php :
$editRow = $_GET['id'];
i'm facing fetch problem in my code. the statement couldn't return the value in $row[]. i have declared the variable before, but only one variable could show in the result. here is my code :
<?php
//require_once('function.php');
//session_start();
//if (!is_user()) {
// redirect('signin.php');
//}
$page_title = "Purchase Order";
include_once 'header.php';
$no_po = $_GET['no_po'];
// include database and object files
include_once 'config/database.php';
//$total_harga = $harga_jual * $qty;
// instantiate database and product object
$database = new Database();
$db = $database->getConnection();
$query = "SELECT
po.no_po,
barang.nama_barang,
klien.nama_klien,
po.tgl_po,
po.qty,
barang.harga_jual,
po.status_po,
po.keterangan,
surat_pengantar.tgl_kirim,
gudang.nama_gudang,
barang.harga_jual * po.qty AS total_harga
FROM
public.po,
public.barang,
public.klien,
public.good_receipt,
public.gudang,
public.surat_pengantar
WHERE
no_po = :no_po AND
po.id_barang = barang.id_barang AND
po.id_klien = klien.id_klien AND
po.no_po = surat_pengantar.no_po AND
po.no_po = good_receipt.no_po AND
gudang.id_gudang = good_receipt.id_gudang";
$stmt = $db->prepare( $query );
$stmt->bindParam(':no_po',$no_po);
$result = $stmt->execute();
$no_po ;
$nama_barang=null;
$harga_jual=null;
$qty=null;
$nama_klien=null;
$total_harga=null;
$status_po=null;
$tgl_po=null;
$tgl_kirim=null;
$nama_gudang=null;
$keterangan=null;
while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
$no_po = $row['no_po'];
$nama_barang = $row['nama_barang'];
$nama_klien = $row['nama_klien'];
$tgl_po = $row['tgl_po'];
$qty = $row['qty'];
$harga_jual = number_format($row['harga_jual'],0,",",".");
$status_po = $row['status_po'];
$keterangan = $row['keterangan'];
$tgl_kirim = $row['tgl_kirim'];
$nama_gudang = $row['nama_gudang'];
$total_harga = number_format($row['total_harga'],0,",",".");
}
?>
<body>
<div class="container">
<div class="row">
<div class="col-xs-6">
<h1>
<a href="https://twitter.com/tahirtaous">
<img src="YSU.png">
Logo here
</a>
</h1>
</div>
<div class="col-xs-6 text-right">
<h1>Purchase Order</h1>
<h1><small><?php echo $no_po?></small></h1>
</div>
</div>
<div class="row">
<div class="col-xs-5">
<div class="panel panel-default">
<div class="panel-heading">
<h4>From: Your Name</h4>
</div>
<div class="panel-body">
<p>
Address <br>
details <br>
more <br>
</p>
</div>
</div>
</div>
<div class="col-xs-5 col-xs-offset-2 text-right">
<div class="panel panel-default">
<div class="panel-heading">
<h4>Detail Invoice</h4>
</div>
<div class="panel-body">
<table border="0">
<tr>
<td>Tanggal PO</td>
<td>:</td>
<td><?php echo $tgl_po?></td>
</tr>
<tr>
<td>Gudang</td>
<td>:</td>
<td><?php echo $nama_gudang?></td>
</tr>
<tr>
<td>Nama Pelanggan</td>
<td>:</td>
<td><?php echo $nama_klien?></td>
</tr>
<tr>
<td>Status Purchase Order</td>
<td>:</td>
<td><?php echo $status_po?></td>
</tr>
<tr>
<td>Tanggal Kirim</td>
<td>:</td>
<td><?php echo $tgl_kirim?></td>
</tr>
<tr>
<td>Mata Uang</td>
<td>:</td>
<td>IDR(Rp)</td>
</tr>
<tr>
<td>Term Pembayaran</td>
<td>:</td>
<td>30 hari</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<!-- / end client details section -->
<table class="table table-bordered">
<thead>
<tr>
<th>
<h4>No.item</h4>
</th>
<th>
<h4>Nama barang</h4>
</th>
<th>
<h4>Quantity</h4>
</th>
<th>
<h4>Price</h4>
</th>
<th>
<h4>Keterangan</h4>
</th>
<th>
<h4>Sub Total</h4>
</th>
</tr>
</thead>
<tbody>
<?php
$no=1;
echo "<tr>";
echo "<td>{$no}</td>";
echo"<td>{$nama_barang}</td>";
echo"<td>{$qty}</td>";
echo"<td class='text-right'>{$harga_jual}</td>";
echo"<td class='text-right'>{$keterangan}</td>";
echo"<td class='text-right'>{$total_harga}</td>";
echo"</tr>";
$no++;
echo"</tbody>";
echo"</table>";
?>
<div class="row text-right">
<div class="col-xs-2 col-xs-offset-8">
<p>
<strong>
Total : <br>
</strong>
</p>
</div>
<div class="col-xs-2">
<strong>
Rp<?php echo $total_harga?> <br>
</strong>
</div>
</div>
</div>
</div>
</body>
</html>
please help me to solve this. thanks
You are over-writing the results with each iteration of your while clause:
You want to output the HTML as you process each row from the recordset.
I think you are looking to do something like this though it has been quite a while since I wrote procedural PHP:
<body>
<?php
while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
$no_po = $row['no_po'];
$nama_barang = $row['nama_barang'];
$nama_klien = $row['nama_klien'];
$tgl_po = $row['tgl_po'];
$qty = $row['qty'];
$harga_jual = number_format($row['harga_jual'],0,",",".");
$status_po = $row['status_po'];
$keterangan = $row['keterangan'];
$tgl_kirim = $row['tgl_kirim'];
$nama_gudang = $row['nama_gudang'];
$total_harga = number_format($row['total_harga'],0,",",".");
?>
<div class="container">
<div class="row">
<div class="col-xs-6">
<h1>
<a href="https://twitter.com/tahirtaous">
<img src="YSU.png">
Logo here
</a>
</h1>
</div>
<div class="col-xs-6 text-right">
<h1>Purchase Order</h1>
<h1><small><?php echo $no_po?></small></h1>
</div>
</div>
<div class="row">
<div class="col-xs-5">
<div class="panel panel-default">
<div class="panel-heading">
<h4>From: Your Name</h4>
</div>
<div class="panel-body">
<p>
Address <br>
details <br>
more <br>
</p>
</div>
</div>
</div>
<div class="col-xs-5 col-xs-offset-2 text-right">
<div class="panel panel-default">
<div class="panel-heading">
<h4>Detail Invoice</h4>
</div>
<div class="panel-body">
<table border="0">
<tr>
<td>Tanggal PO</td>
<td>:</td>
<td><?php echo $tgl_po?></td>
</tr>
<tr>
<td>Gudang</td>
<td>:</td>
<td><?php echo $nama_gudang?></td>
</tr>
<tr>
<td>Nama Pelanggan</td>
<td>:</td>
<td><?php echo $nama_klien?></td>
</tr>
<tr>
<td>Status Purchase Order</td>
<td>:</td>
<td><?php echo $status_po?></td>
</tr>
<tr>
<td>Tanggal Kirim</td>
<td>:</td>
<td><?php echo $tgl_kirim?></td>
</tr>
<tr>
<td>Mata Uang</td>
<td>:</td>
<td>IDR(Rp)</td>
</tr>
<tr>
<td>Term Pembayaran</td>
<td>:</td>
<td>30 hari</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<!-- / end client details section -->
<table class="table table-bordered">
<thead>
<tr>
<th>
<h4>No.item</h4>
</th>
<th>
<h4>Nama barang</h4>
</th>
<th>
<h4>Quantity</h4>
</th>
<th>
<h4>Price</h4>
</th>
<th>
<h4>Keterangan</h4>
</th>
<th>
<h4>Sub Total</h4>
</th>
</tr>
</thead>
<tbody>
<?php
$no=1;
echo "<tr>";
echo "<td>{$no}</td>";
echo"<td>{$nama_barang}</td>";
echo"<td>{$qty}</td>";
echo"<td class='text-right'>{$harga_jual}</td>";
echo"<td class='text-right'>{$keterangan}</td>";
echo"<td class='text-right'>{$total_harga}</td>";
echo"</tr>";
$no++;
echo"</tbody>";
echo"</table>";
?>
<div class="row text-right">
<div class="col-xs-2 col-xs-offset-8">
<p>
<strong>
Total : <br>
</strong>
</p>
</div>
<div class="col-xs-2">
<strong>
Rp<?php echo $total_harga?> <br>
</strong>
</div>
</div>
</div>
</div>
<?
}
?>
</body>
</html>
how do I get data value when I echo data inside HTML tag?
$database = new Database();
$db = $database->getConnection();
$query = "SELECT
po.no_po,
barang.nama_barang,
klien.nama_klien,
po.tgl_po,
po.qty,
barang.harga_jual,
po.status_po,
po.keterangan,
surat_pengantar.tgl_kirim,
gudang.nama_gudang,
barang.harga_jual * po.qty AS total_harga
FROM
public.po,
public.barang,
public.klien,
public.good_receipt,
public.gudang,
public.surat_pengantar
WHERE
po.no_po = ?
po.id_barang = barang.id_barang AND
po.id_klien = klien.id_klien AND
po.no_po = surat_pengantar.no_po AND
po.no_po = good_receipt.no_po AND
gudang.id_gudang = good_receipt.id_gudang";
$stmt = $db->prepare( $query );
$stmt->bindParam(1,$no_po);
$stmt->execute();
?>
<body>
<?php
$no=1;
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$no_po = $row['no_po'];
$nama_barang = $row['nama_barang'];
$nama_klien = $row['nama_klien'];
$tgl_po = $row['tgl_po'];
$harga_jual = $row['harga_jual'];
$qty = $row['qty'];
$total_harga = $row['total_harga'];
$status_po = $row['status_po'];
$keterangan = $row['keterangan'];
$nama_gudang = $row['nama_gudang'];
$tgl_po = $row['tgl_po']; */
$no++;
?>
<div class="container">
<div class="row">
<div class="col-xs-6">
<h1>
<a href="https://twitter.com/tahirtaous">
<img src="YSU.png">
Logo here
</a>
</h1>
</div>
<div class="col-xs-6 text-right">
<h1>Purchase Order</h1>
<h1><small><?php echo $no_po;?></small></h1>
</div>
</div>
<div class="row">
<div class="col-xs-5">
<div class="panel panel-default">
<div class="panel-heading">
<h4>From: Your Name</h4>
</div>
<div class="panel-body">
<p>
Address <br>
details <br>
more <br>
</p>
</div>
</div>
</div>
<div class="col-xs-5 col-xs-offset-2 text-right">
<div class="panel panel-default">
<div class="panel-heading">
<h4>Detail Invoice</h4>
</div>
<div class="panel-body">
<table border="0">
<tr>
<td>Tanggal PO</td>
<td>:</td>
<td><?php echo $tgl_po;?></td>
</tr>
<tr>
<td>Gudang</td>
<td>:</td>
<td><?php echo $nama_gudang?></td>
</tr>
<tr>
<td>Nama Pelanggan</td>
<td>:</td>
<td><?php echo $nama_klien?></td>
</tr>
<tr>
<td>Status Purchase Order</td>
<td>:</td>
<td><?php echo $status_po?></td>
</tr>
<tr>
<td>Tanggal Kirim</td>
<td>:</td>
<td><?php echo $tgl_kirim?></td>
</tr>
<tr>
<td>Mata Uang</td>
<td>:</td>
<td>IDR(Rp)</td>
</tr>
<tr>
<td>Term Pembayaran</td>
<td>:</td>
<td>30 hari</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<!-- / end client details section -->
<table class="table table-bordered">
<thead>
<tr>
<th>
<h4>No.item</h4>
</th>
<th>
<h4>Nama barang</h4>
</th>
<th>
<h4>Quantity</h4>
</th>
<th>
<h4>Price</h4>
</th>
<th>
<h4>Keterangan</h4>
</th>
<th>
<h4>Sub Total</h4>
</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $no?></td>
<td><?php echo $nama_barang?></td>
<td><?php echo $qty?></td>
<td class='text-right'><?php echo $harga_jual?></td>
<td class='text-right'><?php echo $keterangan?></td>
<td class='text-right'><?php echo $total_harga?></td>
</tr>
</tbody>
</table>
<div class="row text-right">
<div class="col-xs-2 col-xs-offset-8">
<p>
<strong>
Total : <br>
</strong>
</p>
</div>
<div class="col-xs-2">
<strong>
Rp<?php echo $total_harga?> <br>
</strong>
</div>
</div>
</div>
</body>
</html>
If I remove no_po = :no_po from my query, the result just get the value from one no_po, meanwhile I want the result exist based on no_po.
I declared variable but echo data inside tag HTML doesn't works. The result should get value based on no_po.
Could anyone help me to fix this?
You might want to look into a LEFT JOIN somewhere. What's could be happening is that with all the joins you are using implicitly, the row which you are looking for that does exist, is already being ruled out by the joins. Implicit joins are inner joins and inner joins require all tables to be present with the matching values. So if all the tables are able to join except for your last one 'surat_pengantar', it will nullify the result from the first table that matched on no_po. This is because your condition of po.no_po = surat_pengantar.no_po is false.
On my page I want to make a query to the database and paginate the results, so that they are in descending order based on the amount of people viewing the page at the current time. I want it to read left to right for the top three and then break to a new row and then read left to right again for the results four to six and so on and so on and so forth.
So I have the table laid out like this:
<div class="popular1">
<table class="pop-table-thumb">
<tr colspan="3">
<div class="pop-table-header">
Most popular
</div>
<br>
</tr>
<tr>
<td>
<div class="pop-thumb">
<img class="img-thumb" src="Images/DefaultThumbnail.gif"/>
</div>
</td>
<td>
<div class="pop-thumb">
<img class="img-thumb" src="Images/DefaultThumbnail.gif"/>
</div>
</td>
<td>
<div class="pop-thumb">
<img class="img-thumb" src="Images/DefaultThumbnail.gif"/>
</div>
</td>
</tr>
<tr>
<td>
<div class="pop-thumb">
<img class="img-thumb" src="Images/DefaultThumbnail.gif"/>
</div>
</td>
<td>
<div class="pop-thumb">
<img class="img-thumb" src="Images/DefaultThumbnail.gif"/>
</div>
</td>
<td>
<div class="pop-thumb">
<img class="img-thumb" src="Images/DefaultThumbnail.gif"/>
</div>
</td>
</tr>
<tr>
<td>
<div class="pop-thumb">
<img class="img-thumb" src="Images/DefaultThumbnail.gif"/>
</div>
</td>
<td>
<div class="pop-thumb">
<img class="img-thumb" src="Images/DefaultThumbnail.gif"/>
</div>
</td>
<td>
<div class="pop-thumb">
<img class="img-thumb" src="Images/DefaultThumbnail.gif"/>
</div>
</td>
</tr>
</table>
</div>
I know how to do basic pagination and listing the results from an assoc query like this for example:
$query = mysql_query("SELECT `something` FROM `something`");
while ($assoc_array = mysql_fetch_assoc($query)) {
echo '<p>', $assoc_array['something'] ,'</p>';
}
so does anyone have any ideas on how I should go about this?
You can easily create 3 wide rows, by using a counter and modulus %
<div class="popular1">
<table class="pop-table-thumb">
<tr>
<td colspan="3"><div class="pop-table-header">Most popular</div><br></td>
</tr>
<?php
$counter = 1; // basic counter to be used in the while loop
while($row = .....){
if($counter%3 == 1){ // if modulus == 1 (ie. 1,4,7) start a row
echo'<tr>';}
// This is where you can change your data from your database
echo '<td><div class="pop-thumb"><img class="img-thumb" src="Images/DefaultThumbnail.gif"/></div></td>';
if($row%3 == 0){ // if modulus == 0 (ie. 3,6,9) close the row
echo'</tr>';}
$counter++;} // increase the counter
?>
</table>
</div>