MDanz 0 Junior Poster

i need some help fixing this .. i've made the td id the counter, which works.

In mysql i have a column named position. For this particular row in mysql the position is 1.

how do i input this result into the td id='1'?

i tried below but it for obvious reasons it didn't work.

<?php
$width = 1024;
$height = 768;

$rows2=$height/250;
$cols2=$width/120;


$rows=round($rows2,0);
$cols=round($cols2,0);


echo "<br />$rows $cols";
$counter = 0;

$position = 1;
$table = "SELECT * FROM `Stacks` WHERE origin='$position'";
$found = mysql_num_rows(mysql_query($table));
if ($found==0){
$template = "<img src='empty.jpg' />";
	} else {
	$template = "";
	
	}

echo "<table border='1' bordercolor='#000000' cellspacing='3' >\n";

// $i=1 means 1 row. so for every $rows equal or greater than $i, add another row.
for($i=1;$i<=$rows;$i++) {

echo "<tr>\n";

// $j=1 means 1 column. so for every $cols equal or greater than $j, add another column.
for($j=1;$j<=$cols;$j++) {
echo "<td width='101px' height='101px' id='$counter'>$template</td>\n";
$counter++;
}


echo "</tr>\n";

}

echo "</table>\n";


?>