Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8729457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:50:15+00:00 2026-06-13T08:50:15+00:00

I stuck on this, I want to create a table with 10 rows, each

  • 0

I stuck on this,

I want to create a table with 10 rows, each row having “same drop down menu” of 10 products. But in every row different product selected. example in first row first product in second row second product and so on. The bellow code is showing drop down menu in each row but every row have first product selected. How can I select next product for next row?

    <table>
    <tr>
        <td>
            <select>
                <?php
                    $query = "SELECT * FROM table_name WHERE featured=1 LIMIT 10";
                    $result = mysqli_query($connection, $query);
                    while($row = mysqli_fetch_array($result)){
                        echo "<option>".$row["product_name"]."</option>"
                    }
                ?>
             </select>
        </td>
        <td>
            <select>
                <?php
                    $query = "SELECT * FROM table_name WHERE featured=1 LIMIT 10";
                    $result = mysqli_query($connection, $query);
                    while($row = mysqli_fetch_array($result)){
                        echo "<option>".$row["product_name"]."</option>"
                    }
                ?>
             </select>
        </td>
    </tr>
</table>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:50:16+00:00Added an answer on June 13, 2026 at 8:50 am
        <? 
        //Only Once call to DB
        $query = "SELECT * FROM tbl WHERE featured=1 LIMIT 10";
        $result = mysqli_query($connection, $query); 
        $pos = 0;
        $currentRow = 0;
        ?>
    
        <table>
            <tr>
                </td>
                <select>
                    <?php
    
                    while($row = mysqli_fetch_array($result)){
    
                    if($pos==$currentRow)
                       echo "<option selected=\"selected\">".$row["product_name"]."                     </option>";
                    else
                       echo "<option>".$row["product_name"]."</option>";
                    $pos++;
    
                    }
    
                    mysqli_data_seek( $result, 0 );
                    $pos = 0;
                    $currentRow++;
    
                    ?>
                </select>
                </td>
            </tr>
            <tr>
                </td>
                <select>
                    <?php
                   while($row = mysqli_fetch_array($result)){
    
                    if($pos==$currentRow)
                       echo "<option selected=\"selected\">".$row["product_name"]."                     </option>";
                    else
                       echo "<option>".$row["product_name"]."</option>";
                               $pos++;
    
                    }
    
                    mysqli_data_seek( $result, 0 );
                    $pos = 0;
                    $currentRow++;
                    ?>
    
                </select>
                </td>
            </tr>
            </table>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I an trying to create an overlay for table rows. I want the overlay
I am still stuck up in this problem. I want to create dynamically multiple
I want to create dymamic SQL code to automatically create a table-replication. I'm stuck
I want to know what does RETURN_VALUE mean! I'm stuck at this thing. How
Im stuck with this little project in C# but basically my problem is this:
I have a table which looks like this: CREATE TABLE `library_mix` ( `lib_mix_id` VARCHAR(64)
I may be missing something but I am stuck in this scenario: I have
setup: mysql> create table product_stock( product_id integer, qty integer); Query OK, 0 rows affected
The table arg_rec contains 800K rows on my test machine, normally this table will
I'm learning SSIS and this seems like an easy task but I'm stuck. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.