This case works perfectly except for one thing. It won't print the first label. The way this is supposed to work is this.
label in the database is set to either 0 for no labels or 1 for 1 label or 2 for a label for each of the quantity of the item.
$x is what decides when to start a new row in the table.
case'labels':
{
$page_title= "Labels ";
$query="select * from inventy where label > '0' order by item ASC";
$result = mysql_query($query);
$row = mysql_fetch_object($result);
include("bits/labelhead.php");
echo "<table class=label>";
$x=0;
while($row = mysql_fetch_object($result)){
if($row->label==2){
for ($i=1; $i<=$row->qty; $i++){
If($x==0){
echo "<tr>";
echo "<td class=lbl> ".$row->item."<br> $".number_format($row->price,2)."</td>";
$x=$x+1;
}elseif($x==10){
echo "<td class=lbl> ".$row->item."<br> $".number_format($row->price,2)."</td></tr>";
$x=0;
}else{
echo "<td class=lbl> ".$row->item."<br> $".number_format($row->price,2)."</td>";
$x=$x+1;
}
}
}else{
If($x==0){
echo "<tr>";
echo "<td class=lbl> ".$row->item."<br> $".number_format($row->price,2)."</td>";
$x=$x+1;
}elseif($x==10){
echo "<td class=lbl> ".$row->item."<br> $".number_format($row->price,2)."</td></tr>";
$x=0;
}else{
echo "<td class=lbl> ".$row->item."<br> $".number_format($row->price,2)."</td>";
$x=$x+1;
}
}
}
echo "</table>";
break;
}
Any idea what I did wrong?