display results in loop in tab pannels

code:[php]


    <?php $sql = mysql_query(“SELECT * FROM categories”);
    while($row1 = mysql_fetch_array($sql)){
    $category = $row1[“category”];
    $sub =$row1[“subcategory”];
    ?>
  • <?php echo $category; ?>
  • <?php // set layout vars $x = 1; // set $x $start = array ('1', '10', '19', '28', '37', '46', '55', '64', '73', '82', '91', '100', '109', '118', '127', '135'); //columns will be started at each of these numbers $end = array( '9', '18', '27', '36', '45', '54', '63', '72', '81', '90', '99','108','117', '126' ); // set numbers to end columns at ?>
        <?php echo '<table border="1px" cellpadding="0px" cellspacing="0px" ><tr height=\'50px\'>'; //start the table, and the row.
    

    // Query member data from the database and ready it for display
    $sql = mysql_query(“SELECT * FROM products where category=’$category’”);
    while($row2 = mysql_fetch_array($sql)){
    $product = $row2[“product”];
    $id =$row2[“id”];
    $price =$row2[“price”];
    if (in_array($x, $start)) { // if x equals a number in the start array
    echo ‘

    ’; // start a column
    } ?>
    <?php $sql = mysql_query("SELECT * FROM categories");
    

    while($row3 = mysql_fetch_array($sql)){
    $category = $row3[“category”];
    $sub =$row3[“subcategory”];
    ?>

    <?php } ?>
    <div id="products">
      <form action="" method="POST" name="myform<?php echo $id; ?>" class="myform<?php echo $id; ?>">
        <input type="hidden" name="hiddenField" class="hiddenField" value="<?php echo $product; ?>" />
        <input type="hidden" name="hiddenField2" class="hiddenField2" value="<?php echo $id; ?>" />
        <input type="hidden" name="hiddenField1" class="hiddenField1" value="<?php echo $price; ?>" />
      <input type="submit" name="submit" class="submit" value="<?php echo $product; ?>" style="background-color:lightgreen; height:50px; padding: 0px; margin:0px; width:100px;">  </form>
    </div>
    
    <?php if (!in_array($x, $end)){ // if $x equals anything OTHER than 9, 18, etc - put in a line break } else { // else if it DOES equal 9, 18 ,etc end the column echo ''; } $x ++; // increase x to keep count } // while loop ends //now outside of the loop, $x = $x - 1; //subtract the last $X++ so you know exactly how many buttons were added if (!in_array($x, $end)){ // if $x equals anything OTHER than 9, 18, etc - end the column as it wouldn't have ended itself echo ''; } echo ''; // close the row and table ?><?php

    }
    ?>

      </div>  
    [/php]
    

    so the problem I am having is getting the database results to display properly inside of tabbed pannels…currently only one tab and one button displays, there should be like 10 tabs and over 100 buttons. I am pretty sure it has to do with where my divs for the tabs are placed inside of my code. please only pay attention to this question, other stuff in there I will fix later, but this is the main thing right now. I will take any suggestions. thanks

    here is an example of what I want:

    Category1 category2 category3 category4 etc.
    product1 product2 product3 product4 etc.
    subcat1(if applicable) etc.

    etc.

    product2 could be under any category, just depending on what it would fall under.

Sponsor our Newsletter | Privacy Policy | Terms of Service