How can I read the latest number from the following code
<table width="100" border="1" >
<tr align="center" bgcolor="#999999" >
<td >NO</td>
<td >Name</td>
<td >PBSID</td>
</tr>
$query ="select * from stock ";
$hasil = mysql_query($query);
$no=0;
while ($row = mysql_fetch_array($hasil))
{
$no++;
if($x != $row[pbsid] )
{
$no=1;
echo "<tr bgcolor=#CCCCCC>
<td colspan=4 ><b> GROUP $row[pbsid]</b></td>
</tr>";
}
$mo=count($no);
echo "<tr><td>$no </td><td> $row[bnama]</td><td>$row[pbsid] </td></tr>";
$x = $row["pbsid"];
}
The result:
===========
NO | NAME | GROUP
---------------------------------------
===========
GROUP 1
---------------------------------------
===========
1 | A | 1
2 | B | 1
3 | C | 1
4 | D | 1
---------------------------------------
===========
GROUP 2
---------------------------------------
===========
1 | A | 2
2 | B | 2
3 | C | 2
I want to show the latest GROUP number, Group 1=4 and Group 2=3, can anyone help me with this?
Try this query:
SELECT s.*, c.count
FROM stock AS s
LEFT JOIN ( SELECT pbsid, COUNT(1) AS `count` FROM stock GROUP BY pbsid ) AS c
ON s.pbsid = c.pbsid
Now you will have the count for each group, which is what it seems you really want.
If you'd prefer to do all the work in PHP for some reason, you could do it like this:
<table width="100" border="1" >
<tr align="center" bgcolor="#999999" >
<td >NO</td>
<td >Name</td>
<td >PBSID</td>
</tr>
$query ="select * from stock ";
$hasil = mysql_query($query);
$no=0;
$counts = array(); // make an array of counts for each group, keyed by pbsid
$rows = array(); // put all the data from SQL into an array
while ($row = mysql_fetch_array($hasil))
{
$rows[] = $row;
if (!isset($counts[$row[pbsid]]))
{
$counts[$row[pbsid]] = 0; // initialize it to 0
}
$counts[$row[pbsid]]++; // increment for each occurrence of a pbsid
}
foreach ($rows as $row)
{
$no++;
if($x != $row[pbsid] )
{
$no=1;
echo "<tr bgcolor=#CCCCCC>
<td colspan=4 ><b> GROUP $row[pbsid]</b> Count = " . $counts[$row[pbsid]] . " </td>
</tr>";
}
$mo=count($no);
echo "<tr><td>$no </td><td> $row[bnama]</td><td>$row[pbsid] </td></tr>";
$x = $row["pbsid"];
}
Although, I think it's much simpler to just have this information calculated in your query.
This would work
$query ="select * from stock ";
$hasil = mysql_query($query);
$no=0;
$latest = array();
while ($row = mysql_fetch_array($hasil))
{
$no++;
if($x != $row[pbsid] ){
$no=1;
echo "<tr bgcolor=#CCCCCC>
<td colspan=4 ><b> GROUP $row[pbsid]</b></td>
</tr>";
}
$mo=count($no);
echo "<tr><td>$no </td><td> $row[bnama]</td><td>$row[pbsid] </td></tr>";
$x = $row["pbsid"];
$key = 'Group'.$row['pbsid'];
$latest[$key] = $no;
}
print_r($latest);
<table width="100" border="1" >
<tr align="center" bgcolor="#999999" >
<td >NO</td>
<td >Name</td>
<td >PBSID</td>
</tr>
$last_no = array();
$query ="select * from stock ";
$hasil = mysql_query($query);
$no=0;
while ($row = mysql_fetch_array($hasil))
{
$no++;
if($x != $row[pbsid] ){
$no=1;
echo "<tr bgcolor=#CCCCCC>
<td colspan=4 ><b> GROUP $row[pbsid]</b></td>
</tr>";
}
$mo=count($no);
echo "<tr><td>$no </td><td> $row[bnama]</td><td>$row[pbsid] </td></tr>";
$x = $row["pbsid"];
$last_no[] = $no;
}
print_r($last_no);
Change your query $query ="select MAX(no),bnama, pbsid from yourtablename GROUP BY pbsid ";
Related
I am trying to group my data with country and year together and display it in a table but it is currently only grouped by year and not country.
As below -
USA 2020
| Reise | Land | Reisedatnum | Dauer | Reise |
| ------- | ------ | ------------- | ------- | ------- |
|12324 | Ak | 23-10-22 | AF |intensive|
USA 2020
|Reise |Land |Reisedatnum |Dauer |Reise|
|-|-|-|-|-|
|12323 |AG |3-10-22 |AF| intensive|
But it should be shown in one table only as Country and year are the same, currently is showing in a different table. I also grouped by keyregion
In database
keyregion = countryname
Year = $count=$row->jahr;
MySQL Query
function starttable($year,$country)
{
;
?>
<table class="termine" >
<caption class="date"><b><?php echo $country;?> <?php echo $year; ?> </b></caption>
<thead>
<tr>
<th scope="col" class="reisenr">Reise Nr.</th>
<th scope="col" class="land">Land</th>
<th scope="col" class="datum">Reisedatum</th>
<th scope="col" class="dauer">Dauer</th>
<th scope="col" class="reise">Reise</th>
<th scope="col" class="preis">Reisepreis</th>
</tr>
</thead>
<tbody>
<?
}
function closetable()
{
echo "
</tbody>
</table>
";
}
function ausgabe_einfach($zeile)
{
global $status;
$anfang = htmlentities($zeile->beginn_f,ENT_COMPAT,'UTF-8',0);
$ende = htmlentities($zeile->ende_f ,ENT_COMPAT,'UTF-8',0);
$commen = ($zeile->comment_de) ? "<div class=\"comment\">". nl2br(htmlentities($zeile->comment_de,ENT_COMPAT,'UTF-8',0)) ."</div>" : "";
?>
<tr>
<td><?php echo $zeile->reisenr ?></td>
<td><?php echo $zeile->keycountry .''.'<br>' . $zeile->Shortlink . ''?></td>
<td class="commdate"><?php echo $anfang ?> – <?php echo $ende ?></td>
<td><?php echo $zeile->tage+1 ?> T</td>
<td><?php echo $zeile->tourname ?></td>
<td><?php echo ($zeile->price) ? $zeile->price." Euro" : "-" ?> </td>
</tr>
<?
}
// Datenbankverbindung
$connection = #mysqli_connect("localhost","username","password","DB");
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
if ($connection)
{
mysqli_set_charset($connection, "UTF8");
mysqli_query($connection, "SET lc_time_names = 'de_DE'");
$keywords = "Afrika";
$zeig = 1;
if ($keysuffix == "")
$where = "WHERE keyregion LIKE \"".$keywords."\" AND zeig='$zeig'" ;
else
$where = "WHERE ( keyregion LIKE \"".$keywords."\" OR keycountry LIKE \"".$keywords.$keysuffix."\" )";
$abfrage = "SELECT reisenr,beginn,ende,airline,status,price,keywords,keyregion,Shortlink,keycountry,tourname, YEAR(beginn) AS jahr, MONTH(beginn) AS month, DATE_FORMAT(beginn,\"%a, %e. %b\") AS beginn_f,DATE_FORMAT(ende,\"%a, %e. %b %Y\") AS ende_f,comment_de, DATEDIFF(ende,beginn) as tage FROM $tabelle $where ORDER BY jahr, keyregion";
$ergebnis = mysqli_query($connection, $abfrage);
$opentab = false; // Tabelle offen
$p_month=0;
// Aktueller Jahresdurchlauf
while($row = mysqli_fetch_object($ergebnis))
{
if ($row->month != $p_month)
{
$p_month=$row->month;
$datee= htmlentities($row->beginn,ENT_COMPAT,'UTF-8',0);
$count=$row->jahr;
$country= $row->keyregion;
$bigin =htmlentities($row->beginn,ENT_COMPAT,'UTF-8',0);
if ($opentab)
closetable();
starttable($count,$country);
$opentab = true;
}
ausgabe_einfach($row);
}
if ($opentab)
closetable();
}
else
{ ?>
Daten können nicht geladen werden.
<?
}
I'm running a MySQL/PHP and i'm trying to display a simple report that tracks when a salesrep contacts a customer. I can't figure out what I'm doing wrong, as i'm a novice in this area. The simplest solution to me seems extremely convoluted (making a separate recordset for each figure). I figured there would have to be a simpler way.
I'm looking to display the number of contacts made during the current week/month/year in a simple table. see below. any help would be greatly appreciated.
|Current|Current| |
| Week | Month | YTD |
------|-------|-------|-------|
Brian | 7 | 14 | 37 |
------|-------|-------|-------|
Chad | 0 | 15 | 27 |
------|-------|-------|-------|
David | 11 | 26 | 52 |
------|-------|-------|-------|
Current recordsets
mysql_select_db($database_Sales, $Sales);
$query_rsCurWeek = "SELECT Sales.rep, COUNT(*) FROM Sales WHERE YEARWEEK(`date`, 1) = YEARWEEK(CURDATE(), 1) GROUP BY Sales.rep";
$rsCurWeek = mysql_query($query_rsCurWeek, $Sales) or die(mysql_error());
$row_rsCurWeek = mysql_fetch_assoc($rsCurWeek);
$totalRows_rsCurWeek = mysql_num_rows($rsCurWeek);
mysql_select_db($database_Sales, $Sales);
$query_rsCurMonth = "SELECT Sales.rep, COUNT(*) FROM Sales WHERE MONTH(date) = MONTH(CURDATE()) GROUP BY Sales.rep";
$rsCurMonth = mysql_query($query_rsCurMonth, $Sales) or die(mysql_error());
$row_rsCurMonth = mysql_fetch_assoc($rsCurMonth);
$totalRows_rsCurMonth = mysql_num_rows($rsCurMonth);
mysql_select_db($database_Sales, $Sales);
$query_rsCurYear = "SELECT Sales.rep, COUNT(*) FROM Sales WHERE YEAR(date) =
YEAR(CURDATE()) GROUP BY Sales.rep";
$rsCurYear = mysql_query($query_rsCurYear, $Sales) or die(mysql_error());
$row_rsCurYear = mysql_fetch_assoc($rsCurYear);
$totalRows_rsCurYear = mysql_num_rows($rsCurYear);
Current Output Table
<table width="400" border="1" cellspacing="0" cellpadding="0">
<tr>
<th width="175" align="center"></th>
<th width="75" align="center">Current<br />Week</th>
<th width="75" align="center">Current<br />Month</th>
<th width="75" align="center">YTD</th>
</tr>
<?php do { ?>
<tr>
<th align="left"><?php echo $row_rsCurYear['rep']; ?></th>
<td align="center"><?php echo $row_rsCurWeek['COUNT(*)']; ?></td>
<td align="center"><?php echo $row_rsCurMonth['COUNT(*)']; ?></td>
<td align="center"><?php echo $row_rsCurYear['COUNT(*)']; ?></td>
</tr>
<?php } while ($row_rsCurWeek = mysql_fetch_assoc($rsCurWeek)); ?>
try{
$sql = "SELECT * FROM contacts";
$result = $pdo->query($sql);
if($result->rowCount() > 0){
echo "<table>";
echo "<tr>";
echo "<th>username</th>";
echo "<th>current_week</th>";
echo "<th>current_month</th>";
echo "<th>ytd</th>";
echo "</tr>";
while($row = $result->fetch()){
echo "<tr>";
echo "<td>" . $row['username'] . "</td>";
echo "<td>" . $row['current_week'] . "</td>";
echo "<td>" . $row['current_month'] . "</td>";
echo "<td>" . $row['ytd'] . "</td>";
echo "</tr>";
}
echo "</table>";
// Free result set
unset($result);
} else{
echo "No records matching your query were found.";
}
} catch(PDOException $e){
die("ERROR: Could not able to execute $sql. " . $e->getMessage());
}
Hello i have a table with some fields like
here i want make colors for table entire rows..means if ASR value is 75 to 100 should get one color and 50 to 75 should get another color and below 50 should get another color.
and here is my php code
<table width="75%" border="1">
<tr>
<td align="center">channel no</td>
<td align="center">IP</td>
<td align="center">Total calls</td>
<td align="center">Connected calls</td>
<td align="center">Disconnected calls</td>
<td align="center">Duration</td>
<td align="center">ASR</td>
<td align="center">ACD</td>
</tr>
<?php
while ($row = mysql_fetch_assoc($result)) {
//$minutes = gmdate("H:i:s", $row['tduration']);
echo "<tr>
<td>".$row['channel']." </td>
<td>".$row['ip']." </td>
<td>".$row['totalcalls']." </td>";
if ($row['totalcalls']>1){
$sql1 = "SELECT count(duration) as count FROM gateways where duration=0 and ip='".$_POST['ip']."' and channel='".$row['channel']. "' and (connect_datetime BETWEEN ' ".$_POST['toval']." ' and '".$_POST['fromval']."' or disconnect_datetime BETWEEN ' ".$_POST['toval']." ' and '".$_POST['fromval']."' ) Group by channel";
$result1 = mysql_query($sql1, $link);
$norow=mysql_fetch_assoc($result1);
$attenedcalls=($row['totalcalls']-$norow['count']);
echo "<td>".$attenedcalls." </td>";
$disconnectedcalls=($row['totalcalls']-$attenedcalls);
echo "<td>".$disconnectedcalls." </td>";
echo " <td>".$row['tduration']." </td>";
echo "<td>".(($attenedcalls/$row['totalcalls'])*100)."</td>";
}else{
echo "<td>".$row['totalcalls']."</td>";
echo "<td>100</td>";
}
$minutes = gmdate("H:i:s", ($row['tduration']/$attenedcalls));
echo " <td>".$minutes." </td>
</tr>";
}
?>
</table>
thanks in advance
You can try like this
<table width="75%" border="1">
<tr>
<td align="center">channel no</td>
<td align="center">IP</td>
<td align="center">Total calls</td>
<td align="center">Connected calls</td>
<td align="center">Disconnected calls</td>
<td align="center">Duration</td>
<td align="center">ASR</td>
<td align="center">ACD</td>
</tr>
<?php
while ($row = mysql_fetch_assoc($result)) {
$color = '';
if ($row['totalcalls']>1){
$sql1 = "SELECT count(duration) as count FROM gateways where duration=0 and ip='".$_POST['ip']."' and channel='".$row['channel']. "' and (connect_datetime BETWEEN ' ".$_POST['toval']." ' and '".$_POST['fromval']."' or disconnect_datetime BETWEEN ' ".$_POST['toval']." ' and '".$_POST['fromval']."' ) Group by channel";
$result1 = mysql_query($sql1, $link);
$norow=mysql_fetch_assoc($result1);
$attenedcalls=($row['totalcalls']-$norow['count']);
$asr = (($attenedcalls/$row['totalcalls'])*100);
if($asr >= 75 && $asr <=100 ){
$color = 'red';
}else if($asr >= 50 && $asr < 75){
$color = 'cyan';
}else if($asr < 50){
$color = 'blue';
}
}
//$minutes = gmdate("H:i:s", $row['tduration']);
echo "<tr style='background-color : ".$color."'>
<td>".$row['channel']." </td>
<td>".$row['ip']." </td>
<td>".$row['totalcalls']." </td>";
if ($row['totalcalls']>1){
echo "<td>".$attenedcalls." </td>";
$disconnectedcalls=($row['totalcalls']-$attenedcalls);
echo "<td>".$disconnectedcalls." </td>";
echo " <td>".$row['tduration']." </td>";
echo "<td>".$asr."</td>";
}else{
echo "<td>".$row['totalcalls']."</td>";
echo "<td>100</td>";
}
$minutes = gmdate("H:i:s", ($row['tduration']/$attenedcalls));
echo " <td>".$minutes." </td>
</tr>";
}
?>
</table>
[...]
while ($row = mysql_fetch_assoc($result)) {
$asrVal=(($attenedcalls/$row['totalcalls'])*100);
if($asrVal>=50 && $asrVal <=75) $class="from50to75";
if($asrVal>=75 && $asrVal <=100) $class="from75to100";
if($asrVal<50) $class="below50";
//$minutes = gmdate("H:i:s", $row['tduration']);
echo "<tr class='$class'>
[...]
then add:
<style>
tr.from50to75 td{background-color:red;}
tr.from75to100 td{background-color:green;}
tr.below50 td{background-color:blue;}
</style>
Modify your while loop so that you compute the ASR value before emitting the <tr> tag. Use that value to select a class according to the classification you have set up, and emit a tag of the form <tr class=foo> where foo is the class name you have selected. Then it’s just a matter of writing CSS rules for the classes, using class selectors like tr.foo.
(Provided that you have not set color on the td cells. If you have, you need to use selectors like tr.foo td to override such settings.)
I am having a time tryng to pull ALL records out of a database. For example I have the following
$result = mysql_query("SELECT * FROM `plant_info` ORDER BY id LIMIT 0, 50") or die(mysql_error());
// Variables to pull from the database
// I know the line below is the culprit now, so i must change the code below correct? ///
$returneddata = mysql_fetch_array($result);
///////////////////////////////////////////
$LatinName = $returneddata['Latin_Name'];
$CommonName = $returneddata['Common_Name'];
$Category = $returneddata['Category'];
$Type = $returneddata['Type'];
$Fruit = $returneddata['Fruit'];
$Flower = $returneddata['Flower'];
$MinHeight = $returneddata['Min_Height'];
$MaxHeight = $returneddata['Max_Height'];
$MinWidth = $returneddata['Min_Width'];
$MaxWidth = $returneddata['Max_Width'];
$Exposure = $returneddata['Exposure'];
$Comments = $returneddata['Comments'];
$SoilType = $returneddata['Soil_Type'];
$Zone = $returneddata['Zone'];
$PotSize = $returneddata['Pot_Size'];
$CostPrice = $returneddata['Cost_Price'];
$RetailPrice = $returneddata['Retail_Price'];
$ImageName = $returneddata['Image_Name'];
$ImageNameThumb = $returneddata['Image_Name_Thumb'];
$num_rows = mysql_num_rows($result); echo "$num_rows Rows\n";
while ($row = mysql_fetch_array($result)) {
echo " <tr>
<td align=\"center\" bgcolor=\"#000000\">
<p><img src=\"$row[Image_Name]\" style=\"width:120px;height:auto;\"></p>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Latin_Name]</p>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Common_Name]</p>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Category]</p>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Type]</p>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Flower]</p>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Comments]</p>
</td>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>Edit</p>
<p>Print</p>
</td>
</tr>
";
}
The issue i have is that it will pull all the records except for the first one. Every other record shows, there are only 5 records currently.
I am missing something silly I know it. I looked through questions and could not find the answer. Thanks
It could be because you're calling the mysql_fetch_array command twice.
$row = mysql_fetch_array($result);
while ($row = mysql_fetch_array($result)) {
You only need to declare mysql_fetch_array once, which is inside the while parameter.
This should be your code:
$result = mysql_query("SELECT * FROM `plant_info` ORDER BY id LIMIT 0, 30");
while ($row = mysql_fetch_array($result)) {
echo " <tr>
<td align=\"center\" bgcolor=\"#000000\">
<p><img src=\"$row[Image_Name]\" style=\"width:120px;height:auto;\"></p>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Latin_Name]</p>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Common_Name]</p>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Category]</p>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Type]</p>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Flower]</p>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Comments]</p>
</td>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>Edit</p>
<p>Print</p>
</td>
</tr>
";
}
you didn't post valid/all your PHP - there's no mysql_query() call.
SELECT * FROM `plant_info` ORDER BY id LIMIT 0, 30
$row = mysql_fetch_array($result);
while ($row = mysql_fetch_array($result)) {
line 2 there fetches a row and does nothing with it anyway, throwing away the first row. try this:
$result = mysql_query("SELECT * FROM `plant_info` ORDER BY id LIMIT 0, 30");
while ($row = mysql_fetch_array($result)) {
After your question update, it looks like you want to pull out info from the first row, then loop over all the rows. Here's a way to do that:
$result = mysql_query("SELECT * FROM `plant_info` ORDER BY id LIMIT 0, 30");
while ($row = mysql_fetch_array($result)) {
$rows[] = $row;
}
$row = $rows[0];
$LatinName = $returneddata['Latin_Name'];
...
foreach ($rows as $row){
...
}
I am wanting to make the data to show in 2 columns instead of one here is the code I currently use to show the data in 1 column:
<?php
include("config.php");
include("opendb.php");
$get_cats = mysql_query("SELECT * FROM `categories` ORDER BY `displayorder`") or die(mysql_error());
$get_info = mysql_query("SELECT * FROM `systeminfo`") or die(mysql_error());
$info = mysql_fetch_array($get_info);
while($cats = mysql_fetch_array($get_cats)) {
$get_rares = mysql_query("SELECT * FROM `rares` WHERE `catid`='".$cats['id']."'") or die(mysql_error());
echo("<h2>".$cats['name']."</h2><br>
<table width=\"100%\" border=\"0\">
<tr>
<td width=\"20%\" style=\"text-align:center\"><b>Image</b></td>
<td width=\"40%\" style=\"text-align:left\"><b>Item Name</b></td>
<td width=\"10%\" style=\"text-align:center\"><b>Value</b></td>
<td width=\"30%\" style=\"text-align:center\"><b>Last Updated</b></td>
</tr>
");
$color1 = $info[stripe1];
$color2 = $info[stripe2];
$row_count = 0;
while($rare = mysql_fetch_array($get_rares)) {
$row_color = ($row_count % 2) ? $color1 : $color2;
?>
<tr>
<td width="5%" style="text-align:center;background-color:#<?php echo $row_color; ?>"><img alt="" src="<?php echo("".$info[imagepath]."".$rare['image'].""); ?>"></td>
<td width="20%" style="text-align:left;background-color:#<?php echo $row_color; ?>"><?php echo $rare['name']; ?></td>
<td width="20%" style="text-align:center;background-color:#<?php echo $row_color; ?>"><?php echo $rare['value']; ?> Credits</td>
<td width="10%" style="text-align:center;background-color:#<?php echo $row_color; ?>"><?php echo $rare['lastedited']; ?></td>
</tr>
<?php
$row_count++;
}
echo("</table><br>
");
}
?>
Currently is shows as:
1
_________
2
_________
3
_________
4
_________
5
_________
6
_________
I would like it to show like this:
1 | 2
_________ | _________
3 | 4
_________ | _________
5 | 6
_________ | _________
This really doesn't have anything to do with MySQL at all. MySQL's just the source of the data. You'd want something like this:
$record = 0;
while($rare = mysql_fetch_array($get_rares)) {
if ($record % 2 == 0) {
echo "<tr>"; // if on an 'even' record, start a new row
}
echo "<td>{$rare['something']}</td>";
$record++;
if ($record % 2 == 0) {
echo "</tr>"; // close the row if we're on an even record
}
}
For what it's worth, I encorporated MarcB's code into your original code. You were already doing the mod with your row count. I think you want something like this:
<?php
include("config.php");
include("opendb.php");
$get_cats = mysql_query("SELECT * FROM `categories` ORDER BY `displayorder`") or die(mysql_error());
$get_info = mysql_query("SELECT * FROM `systeminfo`") or die(mysql_error());
$info = mysql_fetch_array($get_info);
while($cats = mysql_fetch_array($get_cats)) {
$get_rares = mysql_query("SELECT * FROM `rares` WHERE `catid`='".$cats['id']."'") or die(mysql_error());
echo("<h2>".$cats['name']."</h2><br>
<table width=\"100%\" border=\"0\">
<tr>
<td width=\"20%\" style=\"text-align:center\"><b>Image</b></td>
<td width=\"40%\" style=\"text-align:left\"><b>Item Name</b></td>
<td width=\"10%\" style=\"text-align:center\"><b>Value</b></td>
<td width=\"30%\" style=\"text-align:center\"><b>Last Updated</b></td>
<td width=\"20%\" style=\"text-align:center\"><b>Image2</b></td>
<td width=\"40%\" style=\"text-align:left\"><b>Item Name2</b></td>
<td width=\"10%\" style=\"text-align:center\"><b>Value2</b></td>
<td width=\"30%\" style=\"text-align:center\"><b>Last Updated2</b></td>
</tr>
");
$color1 = $info[stripe1];
$color2 = $info[stripe2];
$row_count = 0;
while($rare = mysql_fetch_array($get_rares)) {
$row_color = ($row_count % 2) ? $color1 : $color2;
if ($row_count % 2 == 0) {
echo "<tr>"; // if on an 'even' record, start a new row
}
echo "<td width='5%' style='text-align:center;background-color:#$row_color;'><img alt='' src='{$info[imagepath]}{$rare['image']}'></td>
<td width='20%' style='text-align:left;background-color:#$row_color;'>{$rare['name']}</td>
<td width='20%' style='text-align:center;background-color:#$row_color;'>{$rare['value']} Credits</td>
<td width='10%' style='text-align:center;background-color:#$row_color;'>{$rare['lastedited']}</td>";
if ($row_count % 2 == 0) {
echo "</tr>"; // close the row if we're on an even record
}
$row_count++;
}
echo "</table><br/>";
}
?>