Hello there!
I hope someone can help as i just dont know what i am doing wrong! I have the following code and works great except it is not finising the table after it gets to the end of the records so the rest of the page does not display.
The resulting page is http://www.thekeepsakeco.co.uk/baby-keepsakes/baby-keepsake-services/fingerprint-jewellery/fingerprint-jewellery.php and code below.
Can anyone see where i am going wrong?
Thanks so much in advance!
<table> <?php
$numcols = 3;// how many columns to display
$numcolsprinted = 0;// no of columns so far
// open database connection
$connection = mysql_connect("localhost", "keepsakecompany", "jkS7Np31") or die ('Unable to connect!');
// select database
mysql_select_db("keepsakeco") or die ('Unable to select database!');
$query = "SELECT itemname, price, thumbnail, itemcode FROM romancart WHERE itemname LIKE '%fingerprint%' ORDER BY itemname";
$result = mysql_query( $query ) or die( "Error in query: $query. " . mysql_error() );// if records present
if( mysql_num_rows( $result ) > 0 )
{// iterate through resultset
// print article titles
while( $row = mysql_fetch_row( $result ) )
{
$tn = $row[ 0 ];
$in = $row[ 1 ];
$sn = $row[ 2 ];
$cn = $row[ 3 ];
if( $numcolsprinted == $numcols )
{
print "</tr>\n<tr>\n";
$numcolsprinted = 0;
}// output row from database
echo "<td><div align=\"center\"> <a href=\"../../../keepsake-product-detail.php?record=$cn\"> <img src=\"$sn\" width=\"100\" ></a> <br> $tn <br> £$in <br> <a href=\"../../../keepsake-product-detail.php?record=$cn\"> more...</a> <br> <br><br></div> </td>\n";// bump up row counter
$numcolsprinted++;
}// end while loop
$colstobalance = $numcols - $numcolsprinted;
for( $i = 1; $i <= $colstobalance; $i++ )
{
}
print "<TD></TD>\n";
}// if no records present
// display message
else{
?><font size="-1">No categories currently available</font>
</tr></table>