Advanced Search

Results 1 to 3 of 3

Thread: Order a table without header

  1. #1
    Join Date
    Nov 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Order a table without header

    Hi,
    I have a searchbox, wich uses a table to display the result, however the result is not displayed as a normal table,
    ie, with headers to order by.
    I want to be able to reorder the result that I got from the database without doing the query to the database again.
    I know how to order a normal table with headers,
    but on this I dont have any header to order by.
    This is the html output with php:
    PHP Code:
    echo "<table class='tabla>;
    do {
    echo "
    <tr>";
    echo "
    <td><p><a href=".$row["link_ingles"].">".$row["id_propiedad"]."</a><br>".$row["text_eng"]."<br>Pool".$row["pool"]."<br>Bedrooms".$row["bedrooms"]."<br>Bathrooms".$row["bathrooms"]."<br>Air-conditioning".$row["air"]."<br>Sleeps max.: ".$row["duermen"]." persons.<br>Internet".$row["internet"]."<br>Prices from".$row["price_eng"]."<br><br><a href=".$row["link_ingles"].">View details</a></p><p></p></td>";
    echo "
    <td><a href=".$row["link_ingles"]."><img class=borderfotos src=".$row["image"]." border=\"0\"></a></td>";
    echo 
    "</tr>";
    echo 
    "<td class='result'>&nbsp;</td>";
    echo 
    "<td class='result'>&nbsp;</td>";
    } while (
    $row mysql_fetch_array($result));

    echo 
    "</table> \n"
    I would like to be able to reorder by bedrooms, prices from etc.
    Thanks in advance.

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,629
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    I'm not sure what you mean by "with[out] headers to order by" …?

    Quote Originally Posted by helenp View Post
    I want to be able to reorder the result that I got from the database without doing the query to the database again. [...]
    I would like to be able to reorder by bedrooms, prices from etc.
    To clarify:

    Do you want the user to be able to sort the data on the webpage, after you output it? or,

    Do you want to sort/display the data in a different order than it comes from the DB? or,

    Do you want to be able to display the same results (possibly in a different order), on subsequent requests, without having to query the DB again?
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

  3. #3
    Join Date
    Nov 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by traq View Post
    I'm not sure what you mean by "with[out] headers to order by" ?



    To clarify:

    Do you want the user to be able to sort the data on the webpage, after you output it? or,

    Do you want to sort/display the data in a different order than it comes from the DB? or,

    Do you want to be able to display the same results (possibly in a different order), on subsequent requests, without having to query the DB again?
    Thanks,
    Without headers I mean, a traditional table has columns and rows and are displayed like this:
    Header1, Header2, Header3
    result, result, result
    Where Header is the name of the column, (title)
    My query is not displayed with the name of the columns,
    In my intrandet the results are displayed with headers and I can order the tables in my intranet.

    But on my website, the results are displayed like this:
    Header 1, result
    header 2, result
    Header 3 result, Header 5 result (an image)
    Header 4, result.
    The script I have in my intranet to order by the header (column name) does not work on this script.
    This is another searchscript and it does not work on this either:
    PHP Code:
        echo "<table>";
    echo 
    "<tr>";
    echo 
    "<td><p><a href=\"http://www.mysite.com/sales/properties_for_sale_marbella.htm?id=".$row["id"]."\">".$row["propertytitle"]."<br>Property ref.: ".$row["id"]."</a><br><p>".$row["text_eng"]."<br><br>Bedrooms: ".$row["bedrooms"]."<br>Price : ".$row["price"]."<br><br><a href=\"http://www.mysite.com/sales/properties_for_sale_marbella.htm?id=".$row["id"]."\">View details</a></p><p></p></td>";
    echo 
    "<td><a href=\"http://www.mmysite.com/sales/properties_for_sale_marbella.htm?id=".$row["id"]."\"><img class='border' src=".$row["image"]." border=\"0\"></a></td>";
    echo 
    "</tr>";
    } while (
    $row mysql_fetch_array($result));

    echo 
    "</table> \n"
    On the second question,
    I want answer 1 and 3, cant see much difference on them, I want to reorder the search withoug having to do a new query to the database:
    Yes: Do you want the user to be able to sort the data on the webpage, after you output it? or,

    NO: Do you want to sort/display the data in a different order than it comes from the DB? or,

    Yes: Do you want to be able to display the same results (possibly in a different order), on subsequent requests, without having to query the DB again?

    Thanks a lot

Similar Threads

  1. displaying a div dynamically with table header
    By svibuk in forum JavaScript
    Replies: 0
    Last Post: 01-25-2012, 06:25 AM
  2. Error when insert session into table order
    By thientanchuong in forum PHP
    Replies: 0
    Last Post: 01-10-2010, 10:18 AM
  3. Image, text and link in random order in a table
    By Bornfree in forum Looking for such a script or service
    Replies: 6
    Last Post: 11-23-2008, 09:32 PM
  4. order by number of rows in anther table?
    By Jas in forum MySQL and other databases
    Replies: 5
    Last Post: 08-12-2008, 07:06 PM
  5. How to freeze the header of table
    By fung in forum HTML
    Replies: 1
    Last Post: 03-14-2007, 04:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •