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 5960557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:50:34+00:00 2026-05-22T18:50:34+00:00

I am not sure how to go about doing this, but I have an

  • 0

I am not sure how to go about doing this, but I have an SQL Database where I query for info. I would like to display the query results in a list on a webpage with a check-box at the beginning so the user can select which they record of info they would like to modify.

My database has over 20+ columns but I only want to display probably 5 columns of data pertaining to the query that I searched for. Currently I have the data being repopulated in text fields. But I would like to go a step further and get the data displayed in a horizontal list.

Basically something like this:

Client searches for an order in the database. Say there are 2 different orders matching the search criteria in the DB. I would like say 5 columns of data from the DB for those 2 orders displayed on a page with a check-box next to each, so the client can then select which order they want to modify.

I am not sure of the code used to display the sql data in a list with a check-box. Thanks!

  • 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-05-22T18:50:35+00:00Added an answer on May 22, 2026 at 6:50 pm

    The code below demonstrates how to:

    1. Query your database
    2. Display it’s output in a table with checkboxes beside each entry
    3. Submit selected checkboxes to a page
    4. Display selection when page reloads

    Beware of some parameters that you may need to modify, e.g. database name, username, password, name of the primary key (“id”).

    # connect to mysql
    $db_link = mysql_connect('localhost', 'root', '');
    if (!$db_link)
        die('Cannot connect : ' . mysql_error());
    
    # select database
    $db_selected = mysql_select_db('test_db', $db_link);
    if (!$db_selected)
        die ('Cannot select database : ' . mysql_error());
    
    # execute search query
    $sql = 'SELECT * FROM `test_table` LIMIT 20';
    $result = mysql_query($sql);
    
    # check result
    if (!$result)
        die('Could not successfully run query: ' . mysql_error());
    
    # display returned data
    if (mysql_num_rows($result) > 0)
    {
        ?>
        <form action="" method="post">
        <table style="border: 1px solid black">
            <?php
                while ($row = mysql_fetch_assoc($result))
                {
                    echo '<tr><td>';
                    echo '<input type="checkbox" name="selected[]" value="'.$row['id'].'"/>';
                    echo '</td>';
                    foreach ($row as $key => $value)
                        echo '<td>'.htmlspecialchars($value).'</td>';
                    echo '</tr>';
                }
            ?>
        </table>
        <input type="submit"/>
        </form>
        <?php
    }
    else
        echo '<p>No data</p>';
    
    # free resources
    mysql_free_result($result);
    
    # display posted data
    echo '<pre>';
    print_r($_POST);
    echo '</pre>';
    
    ?>
    

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know similar questions have been asked, but I'm not sure about the answers
I have another SQL/access 2007 question that seems really basic but I'm not sure
I am not sure about some things in OOP. If I have Class1 ,
I'm using oracle 11 (not sure about the exact version, but since LISTAGG doesn't
I'm not sure if this can be done. But I just wanted to check
I'm not sure if this is on-topic or not here, but it's so specific
Alright, so I'm about 90% sure that this isn't possible, but I thought I'd
I am not sure about how NSSet's anyObject work. What does it mean that
I am not sure about the exact purpose of the following Rampion's code .
I'm not sure about clarity of the STAR word. I'm implementing a search method

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.