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

The Archive Base Latest Questions

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

I have a search form the searches through a packaging database. Everything works fine

  • 0

I have a search form the searches through a packaging database. Everything works fine and dandy, when the search from is submitted I get returned results on a different page displayed in styled boxes with a picture. But unfortunately the seem to display one after another underneath each other. Although it is good that they are returning and I am getting the correct results. I want to be able to display three next to each other, then they go to the next row and display three more, so on and so forth until I have run out of results.

Here is the PHP:

<?php
            $con = mysql_connect ("localhost", "horizon1", "D2j616H5O@Lw");
                   mysql_select_db ("horizon1_delyn", $con);

            if (!$con)
                { 
                    die ("Could not connect: " . mysql_error());
                }

            $descrip = mysql_real_escape_string($_POST['descrip']); 
            $depth   = mysql_real_escape_string($_POST['depth']);
            $varWidth = mysql_real_escape_string($_POST['traywidth']);
            $varHeight= mysql_real_escape_string($_POST['trayheight']);
            $varRange = mysql_real_escape_string($_POST['trayrange']);
            $varType  = mysql_real_escape_string($_POST['traytype']);
            $varShape = mysql_real_escape_string($_POST['trayshape']);
            $varImage = mysql_real_escape_string($_POST['imagename']);

            if (isset($varHeight) && !empty($varHeight)) {
                    $low  = ($varHeight."00");
                    $high = ($varHeight."99");
                } else {
                    $low  = ("000");
                    $high = ("999");
                }

            if (isset($varWidth) && !empty($varWidth)) {
                    $min  = ($varWidth."00");
                    $max = ($varWidth."99");
                } else {
                    $min  = ("000");
                    $max = ("999");
                }   


            $sql = "SELECT * FROM range WHERE 
                        description LIKE '%".$descrip."%'  
                    AND trayrange   LIKE '%".$varRange."%' 
                    AND traytype    LIKE '%".$varType."%' 
                    AND trayshape   LIKE '%".$varShape."%'
                    AND traywidth   BETWEEN '".$min."'  AND '".$max."' 
                    AND trayheight  BETWEEN '".$low."' AND '".$high."' ";


                $r_query = mysql_query($sql);  

                while ($row = mysql_fetch_array($r_query)) 
                    { 
                        echo '<div id="results">';
                        echo '<p class="image">
                                <img src="   '. $row['imagename'] . '" width="150" length="80"> 
                                    </p>';
                        echo '<div id="table"><br />
                                <strong> Tool Code: </strong>  '. $row['toolcode'];
                        echo '<br /><strong> Description: </strong> '. $row['description']; 
                        echo '<br /><strong> Tray range: </strong> '. $row['trayrange']; 
                        echo '<br /><strong> Tray type:  </strong> '. $row['traytype'];
                        echo '<br /><strong> Tray size:  </strong> '. $row['traysize']; 
                        echo '<br /><strong> Tray shape: </strong> '. $row['trayshape'] . '</div>' . '<br />';
                        echo '<a href="enquire.html">Enquiry Page</a> <br />' . 
                             '<a href="packingtest.html">Back to Search</a>';
                        echo '</div>' . '<br />';
                    }
                if (mysql_num_rows($r_query) <= 0){
                    echo 'No results match your search, please try again';
               }
        ?>

And here is the CSS:

   <style>
 #boxes {
padding: 10px;
margin-top: 20px;
margin: 10px;
float: left;
display: block;
}
 #results {
width: 212px;
    padding: 5px;
    background: #E8CF24;
display: block;
    overflow:auto;

font-family: Verdana, Geneva, sans-serif;
font-size: 11px;
font-color: #FFF;

border: 2px solid #cccccc;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;

-moz-box-shadow: 2px 2px 2px #cccccc;
-webkit-box-shadow: 2px 2px 2px #cccccc;
box-shadow: 2px 2px 2px #cccccc;
}
 #table {
margin-top: 10px;
width: 200px;
    padding: 3px;
    background: #FFF;
display: block;
    overflow:auto;

border: 2px solid #cccccc;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;

-moz-box-shadow: 2px 2px 2px #cccccc;
-webkit-box-shadow: 2px 2px 2px #cccccc;
box-shadow: 2px 2px 2px #cccccc;
}
 .image {
margin-left: 28px;
margin-bottom: 0px;
margin-top: 5px;
}
 a:link {
color: #000423;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
}
 </style>

I have tried to edit it with the CSS but I can change the position and padding, margins and so on forth. But I can’t get them to align next to each other.

Anyone able to help? Thanks in advance 🙂

  • 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-13T06:15:30+00:00Added an answer on June 13, 2026 at 6:15 am

    In your css add this to your #results selector.

    #results {
       float:left
    }
    

    EDIT: Sorry that was not the correct answer. Delete the above code and look into thee below code.

    Replace the while loop with the below code.

    EDIT: Dont forget to initialize the $count variable. ($count = 0;)
    Just copy-paste the code and it should work for you.

       $count = 0;
       while ($row = mysql_fetch_array($r_query)) 
        { 
    
            $t = $count%3;
            echo ($t==2) ?  '<div id="results">' : '<div id="results" style="float:left">';
    
            echo '<p class="image">
                    <img src="   '. $row['imagename'] . '" width="150" length="80"> 
                        </p>';
            echo '<div id="table"><br />
                    <strong> Tool Code: </strong>  '. $row['toolcode'];
            echo '<br /><strong> Description: </strong> '. $row['description']; 
            echo '<br /><strong> Tray range: </strong> '. $row['trayrange']; 
            echo '<br /><strong> Tray type:  </strong> '. $row['traytype'];
            echo '<br /><strong> Tray size:  </strong> '. $row['traysize']; 
            echo '<br /><strong> Tray shape: </strong> '. $row['trayshape'] . '</div>' . '<br />';
            echo '<a href="enquire.html">Enquiry Page</a> <br />' . 
                 '<a href="packingtest.html">Back to Search</a>';
            echo '</div>';
    
            $count++;
        }
    

    This is what i get. I didnt use the css file.

    enter image description here

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

Sidebar

Related Questions

I have a search form through which users can, well, perform searches. When the
I have a search form that searches a table in my database. The table
I have a simple search form which searches the index action of my articles
I have written a simple mysql search form that searches between two dates. This
I have a form that searches a MySQL database using PHP. Currently, when a
I have a php form that searches a SQL database. There are say eight
I have a form that is going to be used to search through a
I have a project that requires a search form that searches two separate eBay
I have a search form. I would like when someone type the term, first
I have a search form where user can search for products within their specified

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.