Reply
Display dynamic data a table
Old 05-10-2006, 12:59 PM Display dynamic data a table
Super Talker

Posts: 145
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-->&nbsp;</td>
  </tr>
  <tr>
    <td height="30" valign="top" bgcolor="#33CC33"><!--DWLayoutEmptyCell-->&nbsp;</td>
  </tr>
  <tr>
    <td height="296" valign="top"><!--Here is going to be put the buttons and the dynamic table-->&nbsp;
    
    <!--<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 && $_i == 0) {

    echo 
"<TD width='77' bordercolor='#000000'>fdhfdh</td>" ;
        echo 
"</TR><BR>\n<TR>";
        
        echo 
"<TD width='77' bgcolor='#000000'>&nbsp;</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
xenia is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 05-10-2006, 09:36 PM Re: Display dynamic data a table
Super Talker

Posts: 145
Go to this link to help you understand what I am interesting to do:http://www.gap.com/browse/category.d...1412,&sortBy=0
xenia is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Display dynamic data a table
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.10948 seconds with 12 queries