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

  • Home
  • SEARCH
  • 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 8775657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:51:36+00:00 2026-06-13T18:51:36+00:00

Currently my search script works but its not doing what I would like it

  • 0

Currently my search script works but its not doing what I would like it to do. At the moment it only returns one search result even though there is about 20 that should shown for a searched item. I am trying to figure out how to get the script to return those missing results that should be shown. So maybe the the experts here could help 🙂

include('data.php');
    //Database Connection
$con=@mysql_connect("$ip", "$user", "$pass")
            or die(mysql_error());

//Select Database
$dbcon=@mysql_select_db($db, $con)
            or die(mysql_error());


$search = $_POST['search'];

$sql = mysql_query("select guid, name, staffmember, dateposted, id, admin_note from $whitelist where guid like '%$search%' or name like '%$search%' or staffmember like '%$search%' or dateposted like '%$search%' or id like '%$search%' or admin_note like '%$search%'");


while ($row = mysql_fetch_array($sql)) {
    //Username
    $name = $row['name'];
    //GUID
    $guid = $row['guid'];
    //Staff Member Who Submitted
    $staff = $row['staffmember'];
    //ID
    $id = $row['id'];
    //Date Posted
    $date = $row['dateposted'];
    //Note From Admin
    $admin = $row['admin_note'];
    }
    ?>
    <html>
    <body>
    <table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
                <tr>
                    <!--<th class="table-header-check"><a id="toggle-all" ></a> </th>-->
                    <th class="table-header-repeat line-left minwidth-1"><a href="">ID</a>  </th>
                    <th class="table-header-repeat line-left minwidth-1"><a href="">GUID</a></th>
                    <th class="table-header-repeat line-left"><a href="">Username</a></th>
                    <th class="table-header-repeat line-left"><a href="">Admin Note</a></th>
                    <th class="table-header-repeat line-left"><a href="">Staff Member</a></th>
                    <th class="table-header-repeat line-left"><a href="">Date Posted</a></th>
                    <th class="table-header-options line-left"><a href="">Options</a></th>

                </tr>
                <tr>

                    <td><?php echo "$id"; ?></td>
                    <td><?php echo "$guid"; ?></td>
                    <td><?php echo "$name"; ?></td>
                    <td><?php echo "$admin"; ?></td>
                    <td><?php echo "$staff"; ?></td>
                    <td><?php echo "$date"; ?></td>
                    <td class="options-width">
                    <?php
                 echo '<a href="edit.php?id=' . $row['id'] . '" title="Edit" class="icon-1 info-tooltip"></a>';
                echo '<a href="delete.php?id=' . $row['id'] . '" title="Edit" class="icon-2 info-tooltip"></a>'; 
                ?>

                    </td>
                </tr>

                </table>
                </body>
                </html>
  • 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-13T18:51:38+00:00Added an answer on June 13, 2026 at 6:51 pm

    You need to output the data within the “while ($row = mysql_fetch_array($sql))” loop. As it is by now, your old values are overwritten for each new row that it fetched.

    In this case your code has to be structured like

     print out table header
     while ($row = mysql_fetch_array($sql)) {
        print out table row
     }
     print out what comes after table
    

    i.e.

    include('data.php');
    //Database Connection
    $con=@mysql_connect("$ip", "$user", "$pass")
            or die(mysql_error());
    
    //Select Database
    $dbcon=@mysql_select_db($db, $con)
            or die(mysql_error());
    
    
    $search = $_POST['search'];
    
    $sql = mysql_query("select guid, name, staffmember, dateposted, id, admin_note from $whitelist where guid like '%$search%' or name like '%$search%' or staffmember like '%$search%' or dateposted like '%$search%' or id like '%$search%' or admin_note like '%$search%'");?>
    
    
    <html>
    <body>
    <table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
                <tr>
                    <!--<th class="table-header-check"><a id="toggle-all" ></a> </th>-->
                    <th class="table-header-repeat line-left minwidth-1"><a href="">ID</a>  </th>
                    <th class="table-header-repeat line-left minwidth-1"><a href="">GUID</a></th>
                    <th class="table-header-repeat line-left"><a href="">Username</a></th>
                    <th class="table-header-repeat line-left"><a href="">Admin Note</a></th>
                    <th class="table-header-repeat line-left"><a href="">Staff Member</a></th>
                    <th class="table-header-repeat line-left"><a href="">Date Posted</a></th>
                    <th class="table-header-options line-left"><a href="">Options</a></th>
    
                </tr>
    
    
    <?php
    while ($row = mysql_fetch_array($sql)) {
    //Username
    $name = $row['name'];
    //GUID
    $guid = $row['guid'];
    //Staff Member Who Submitted
    $staff = $row['staffmember'];
    //ID
    $id = $row['id'];
    //Date Posted
    $date = $row['dateposted'];
    //Note From Admin
    $admin = $row['admin_note'];
    ?>
                <tr>
    
                    <td><?php echo "$id"; ?></td>
                    <td><?php echo "$guid"; ?></td>
                    <td><?php echo "$name"; ?></td>
                    <td><?php echo "$admin"; ?></td>
                    <td><?php echo "$staff"; ?></td>
                    <td><?php echo "$date"; ?></td>
                    <td class="options-width">
                    <?php
     }
    
                 echo '<a href="edit.php?id=' . $row['id'] . '" title="Edit" class="icon-1 info-tooltip"></a>';
                echo '<a href="delete.php?id=' . $row['id'] . '" title="Edit" class="icon-2 info-tooltip"></a>'; 
                ?>
    
                    </td>
                </tr>
    
                </table>
                </body>
                </html>
    

    (To make good and safe code, a few things should be changed, but to get you started, this should work)

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

Sidebar

Related Questions

I'm working on some script and I would like to create search. My project
Currently I use an iterator to search through a vector and test its elements.
Currently I'm using a small search and replace snippet for one of my WordPress
Currently I have an algorithm which somewhat looks like web-spiders or file search systems
I'm currently setting up a Drupal website with localization which works pretty well. But
I have a PHP search suggestion script which uses a MySQL database as its'
I want to show textboxes of the selected radiobutton only. Currently it works as
I want a script to search Google for the lyrics of the currently playing
currently my autocomplete works in displaying the first name of the user, but I
I currently need to search a table of items to validate a list of

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.