Ok- Who knows how to do this
Posted: Tue Dec 21, 2004 7:10 pm
I have noticed on a few other developer sites that alot of them have the functionality of being able to select the order of data ina coloum by clcicking on its heading - i.e lcoulum lists firstnames and when u clcick the coloum title FIRST NAME it automaticall arranges all the data in Ascending alphabetical order.
I want to do the same with all my coloum headers, but How would I go about doing this??
heres my code:
I want to do the same with all my coloum headers, but How would I go about doing this??
heres my code:
Code: Select all
// Define your colors for the alternating rows
$color1 = "#ADD8E6";$color2 = "#E0FFFF";
"<table width="50%" border="0" cellpadding="2" cellspacing="2">
<tr>
<td><b><small>RecNo</small></b></td>
<td><b><small>ID</small></b></td>
<td><b><small>Title</small></b></td>
<td><b><small>First Name</small></b></td>
<td><b><small>Surname</small></b></td>
<td><b><small>Organisation</small></b></td>
<td><b><center><small>Role</small></center></b></td>
<td><b><small>Address(1)</small></b></td>
<td><b><small>Address(2)</small></b></td>
<td><b><small>City</small></b></td>
<td><b><small>Post Code</small></b></td>
<td><b><small>Telephone</small></b></td>
<td><b><small>Mobile</small></b></td>
<td><b><small>Fax</small></b></td>
<td><b><small>Last Contact</small></b></td>
<td><b><small>Contact Again</small></b></td>
<td><b><small>Email</small></b></td>
<td><b><small>Notes</small></b></td>";while ($row =
mysql_fetch_object($sql))
{($color==$color2)? $color = $color1 : $color = $color2;
echo "<tr bgcolor="$color"><td>".$count . '</td><td> ' . $row->person_id .'</td><td>'.
$row->salutation .'</td><td>'.
$row->firstname .'</td><td>'.
$row->surname .'</td><td>'.
$row->organisation .'</td><td>'.
$row->role.'</td><td>'.
$row->address1 .'</td><td>'.
$row->address2 .'</td><td>'.
$row->city .'</td><td>'.
$row->postcode .'</td><td>'.
$row->telephone .'</td><td>'.
$row->mobile .'</td><td>'.
$row->fax .'</td><td>'.
$row->dateoflastcontact.'</td><td>'.
$row->datecontactagain .'</td><td>'.
$row->email .'</td><td>'.
$row->notes .'</td></tr>';
$count += 1;
}
echo "</table>";