Hello everyone,
I am developing a website which displays items dynamically from the mysql database. I dynamicaly display the results from the database into a table of which the number of rows is equal with the number of records for the specific select statement.
What I would like to do is when I print the table with the results to be able to put at the top left and top right position of the table two buttons one for each side.However,the buttons I don't want to be displayed as many times as the records are but only one.
I have already manage to do that but from the right position I cannot put it at the top of the first row.Moreover, in my code I have written a php code to print the results 3 columns per row.
I have post the code and I would be gretfull If you could see where is the error or if is any other way to do it.
PHP Code:
<table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="895" height="151" valign="top" bgcolor="#339933"><!--DWLayoutEmptyCell--> </td> </tr> <tr> <td height="30" valign="top" bgcolor="#33CC33"><!--DWLayoutEmptyCell--> </td> </tr> <tr> <td height="296" valign="top"><!--Here is going to be put the buttons and the dynamic table--> <!--<div id="Layer1"><? //include "search.php"; ?> </div>--> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="5" class="generalfont" > <? $sqlcolour = "Select * from Items,Brands,Kids,Categories where Brands.brandID=Items.brandID and Items.kidID=Kids.kidID and Items.categoryID=Categories.categoryID ";
if (!empty($kids) && $kids != 'kids' ) $sqlcolour .= " and Kids.kid_category = '$kids' "; if (!empty($brands) && $brands != 'brands' ) $sqlcolour.= " and Brands.brand_name='$brands' "; if (!empty($category) && $category != 'category' ) $sqlcolour.= " and Categories.categoryname ='$category'"; $_results =mysql_query($sqlcolour);
$_i = 0; echo "<TR>"; echo "<TD width='17' bordercolor='#990000'><img src='xenia.jpg' width='154' height='66' /></td>" ;
while ($_row = mysql_fetch_assoc($_results)) {
if ($_i > 0 && $_i % 3 == 0) {
echo "<TD width='77' bordercolor='#000000'>fdhfdh</td>" ; echo "</TR><BR>\n<TR>"; echo "<TD width='77' bgcolor='#000000'> </td>" ; } echo "<TD width='155' height='66' bordercolor='#0000FF'><form action='baby_boy_details.php' method='post'> <input name='imageField' type='image' src='/enia/". $_row['image'] ."'>";?> <input name="itemID" type="hidden" value="<? echo $_row["itemID"]; ?>"> <input name="image" type="hidden" value="<? echo $_row["image"]; ?>"> <input name="brand" type="hidden" value="<? echo $_row["brandname"]; ?>"> <input name="colour" type="hidden" value="<? echo $_row["colour"]; ?>"> <? echo"</form>"; echo "<h3 class='brandname'>" . $_row["brand_name"] ."</h3>". $_row["colour"] . "<br>" . $_row["price"] . "</TD>";
$_i++;
}
echo "<TD bordercolor='#990000'>outside loop</td>" ; echo "<TD width='77' bgcolor='#000000'><img src='xenia.jpg' width='154' height='66' /></td>" ; echo "</TR><BR>\n"; ?>
</table> </td> </tr> </table>
Thank you in advance,
Xenia
|