TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 05-13-2009, 07:02 PM   #1 (permalink)
The Contributor
 
Join Date: May 2008
Posts: 36
Thanks: 5
Kay1021 is on a distinguished road
Confused Control the organization of data table by headers

I have a table that contains data from my database. I was wondering if there was a way that I could make the headers (name, date joined, expiry date and fee) control the order of the data in both ascending and descending order. And make the which header is organizing the data currently look different (ie. when data is organized by name...name is bold while other headers are not). I've tried searching for how to do this...but have had no luck with actually accomplishing it.

I'd appreciate any help.

Thanks


Here's my code:
PHP Code:
<?php 
print
<table class="myTable"> 
    <thead> 
      
    <th scope="col"><h2>Name</h2></th> 
    <th scope="col"><h2>Phone Number</h2></th> 
    <th scope="col"><h2>Email</h2></th> 
    <th scope="col"><h2>Date Joined</h2></th> 
    <th scope="col"><h2>Expiry Date</h2></th> 
    <th scope="col"><h2>Fee Paid</h2></th> 
    <th scope="col"><h2>Edit</h2></th> 
    <th scope="col"><h2>Delete</h2></th> 
      
    </thead>'

      
      
    
$sql "SELECT name, phone, email, date_joined, expiry_date, fee FROM customer ORDER BY name";
      
      
    
$qry mysql_query($sql); 
      
    if (
mysql_num_rows($qry) > 0) { 
        while (
$rs mysql_fetch_assoc($qry)) { 
              
              
            print

            <td>' 
$rs['name'] . '</td> 
            <td>' 
$rs['phone'] . '</td> 
            <td>' 
$rs['email'] . '</td> 
            <td>' 
$rs['date_joined'] . '</td> 
            <td>' 
$rs['expiry_date'] . '</td> 
            <td>' 
$rs['fee'] . '</td> 
            <td><a href="edit.php">Edit</a></td> 
            <td><a href="delete.php">Delete</a></td><tr>'

        } 
    } else { 
        print 
'<h4>no result found</h4>'
    } 
print

</table>'

?>
Kay1021 is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
feedback on my class please frostyboy33 Advanced PHP Programming 7 10-22-2012 09:12 AM
Databse structure Village Idiot TalkPHP Developer Team 3 01-16-2009 10:31 PM
This project has begun! Village Idiot TalkPHP Developer Team 40 01-01-2009 04:29 AM
problem getting data on the html table.... jetnet1 General 2 11-24-2008 06:55 PM
Creating a table from loaded data benton General 5 04-20-2008 11:48 AM


All times are GMT. The time now is 03:51 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design