I am writing a tagging template for our company and have run into ome trouble printing a list of database balues in a single cell.
My problem is on line 23 through 32 creating the function to call the list and line 71 where i echo the statement for the particular cell and want to call the function.
Currently it shows my last effort and doesn't work. Either I have parameter problems with the array or I have no errors but also no print for that cell.
Can anyone point me at a function that will fetch a one column, multiple row array and then how to print the list in that one cell, one value on top of another in a one column list?
kitfox
Code:
<?php
$itemidpass = $_GET['itemid'];
$username="test";
$password="tester";
$database="test";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT * FROM sample WHERE item_id = '$itemidpass' ";
$result = mysql_query($query);
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$item = mysql_fetch_row($result);
$desc = $item[5] . ' ' . $item[2];
$imgsrc = ' ' . 'src="/rugtags/images/surya/' .$item[1] .'" alt="" width="250" height="158"';
$query2 = "SELECT item_sizes FROM sizes WHERE item_id = '$itemidpass' ";
$result2 = mysql_query($query2);
function sizes()
{
WHILE($row = mysql_fetch_assoc($result2)){
echo $row[0];
}
}
echo '<table align="center" border="0" bordercolor="#000000" cellpadding=0>';
echo '<tr>';
echo '<td colspan=5 width=800 height=40 bgcolor="#000066"></td>';
echo '</tr>';
echo '<tr>';
echo '<td rowspan=5 width = 16></td>';
echo '<td colspan=4 width=785 valign="bottom"><font face="Verdana" size="4"><u>' .$item[0] .'</u><big>_______________________________________</big></font></td>';
echo '</tr>';
echo '<tr>';
echo '<td colspan=4 width=785 valign="top"><font face="Verdana" size="4">' .$desc .'</font></td>';
echo '</tr>';
echo '<tr>';
echo '<td colspan=4 width=785 height=65></td>';
echo '</tr>';
echo '<tr>';
echo '<td width=250 height=158 rowspan=2 align=top><img' .$imgsrc .' /></td>';
echo '<td rowspan=2 width=16 style="font-size:96px; align:right"><font face="Impact"><b>$</b></font></td>';
echo '<td align=right rowspan=2 height=190 style="font-size:1000%; align:left"><font face="Impact"><b>' .$item[3] .'</b></font></td>';
echo '<td style="font-size:96px; align:left"><font face="Impact"><b>' ,$item[4] .'</b></font></td>';
echo '</tr>';
echo '<tr>';
echo '<td>' .$item[0] .'</td></tr>';
echo '</table>';
echo '<br /><br /><br /><br /><br /><br /><br /><br />';
echo '<table align="center" border="0" bordercolor="#000000" cellpadding="0">';
echo '<tr>';
echo '<td width=200 align=center><font face="Verdana" size="4"><u>COLLECTION</u></font></td>';
echo '<td width=200 align=center><font face="Verdana" size="4"><u>DESIGN</u></font></td>';
echo '<td width=200 align=center><font face="Verdana" size="4"><u>DETAILS</u></font></td>';
echo '<td width=200 align=center><font face="Verdana" size="4"><u>SIZES</u></font></td>';
echo '</tr>';
echo '<tr>';
echo '<td width=200 height=35 valign=bottom align=center><font face="Verdana" size="4">' .$item[5] .'</font></td>';
echo '<td width=200 height=35 valign=bottom align=center><font face="Verdana" size="4">' .$item[6] .'</font></td>';
echo '<td width=200 height=35 valign=bottom align=center><font face="Verdana" size="4">' .$item[7] .'</font></td>';
echo '<td rowspan=5 height=500 width=200 valign=top align=center><font face="Verdana" size="3">' .sizes () .'</td>';
echo '</tr>';
echo '<tr>';
echo '<td width=200 height=35 align=center></td>';
echo '<td width=200 height=35 align=center></td>';
echo '<td width=200 height=35 align=center>' .$item[8] .'</td>';
echo '</tr>';
echo '<tr>';
echo '<td width=200 height=35 align=center><font face="Verdana" size="4">MONTAGE PLANS</font></td>';
echo '<td width=200 height=35 align=center></td>';
echo '<td width=200 height=35 align=center>' .$item[9] .'</td>';
echo '</tr>';
echo '<tr>';
echo '<td margin-left=12px align=left colspan=3 width=200 height=100 align=center><font face="Verdana" size="3">MFSARG00299 - UP TO $299 covered for only $49.99<br />MFSARG00799 - UP TO $799 covered for only $79.99<br />MFSARG01299 - UP TO $1299 covered for only $129.99<br />MFSARG04999 - UP TO $4999 covered for only $199.99<br />MFSARG20000 - UP TO $20000 covered for only $399.99</font></td>';
echo '</tr>';
echo '<tr>';
echo '<td colspan=3 width=200 height=100 align=center><font face="Verdana" size="3"><b>FOR SPECIAL ORDERS</b> - Use <b>ZSU-SPECIAL</b> and add Collection, Design, Size and Price into sales notes</font></td>';
echo '</tr>';
echo '</table>';
?>
My problem is on line 23 through 32 creating the function to call the list and line 71 where i echo the statement for the particular cell and want to call the function.
Currently it shows my last effort and doesn't work. Either I have parameter problems with the array or I have no errors but also no print for that cell.
Can anyone point me at a function that will fetch a one column, multiple row array and then how to print the list in that one cell, one value on top of another in a one column list?
kitfox