Greetings,
I have been searching around the web and different forums for a bit now and i have been looking for the ability to freeze table panes in PHP. I have found nothing thus far. I have the table with the column names and headings and such and this is what i want to freeze and then under that i print out all the information that it is pulling from the database and these amount of data varies based on search options, but I need to freeze the title part so that no matter how far down i scroll i will always be able to see the headings so that I can figure out what the information is that im actually looking at. If you need the code to look at then ill copy it over to here but if anyone can point me in the direction of where i can find out how to freeze table panes in PHP that would be great. Thanks.

    Hi,

    you'd need to use CSS for that I suppose.

    Look at what I did for a footer in a website:

    #footer {
    position:absolute;
    bottom:0;
    left:0;
    width:100%;
    height:footer-<length>;
    background-color: #FFE4C4;
    border-top: 1px solid #600005;
    border-bottom: 1px solid #600005;
    }

    This site is not finished yet.. So I am not sure how it would work with the main content. You need to do something with the overflow property, for the rest of the table.

    SOmething like: Overflow: invisible.

    J.

      well you can do that in css
      here is sample
      <style>
      div.scroll {
      height:495px;
      width: 100%;
      overflow: auto;
      border: 0px solid #666;
      background-color: #FFF;
      padding: 0px;
      </style>

      <table><tr><td>header1</td><td> header 2></td></tr></table>
      <div class="scroll>
      <table> <tr><td>value</td><td>value</td></tr></table>
      </div>

        or in other case if you dont want CSS to do that you can use Iframe

          Thanks for the ideas, Ill probably try out the CSS idea and see how it works if not then ill probably look into Iframes. Thanks for your time.

            4 days later

            I've tried using CSS and I got an example to work in HTML, but I couldn't get the data that is being pulled from the MySQL table to go into the html file from the php file. Im slightly new to PHP and not quite sure how this feature works. If you elaborate a little more that would be great. Thanks

              have you tried displaying the result from your table using php??
              if you already tried then you can insert the result after the <table>

              eg:

              <table><tr><td>header1</td><td> header 2></td></tr></table>
              <div class="scroll>
              <table>
              <tr>
              // you can start here assuming that you are connected to your database
              <?
              $query=mysql_query("select * from yourtable");
              while ($result=mysql_fetch_object($query)) {
              echo "<td>".$result->field1."</td><td>".$result->field2."</td>";
              }
              // end
              </tr>

              </table>
              </div>

              NOTE: you can set the height of the scroll in your style

                Write a Reply...