Copy link to clipboard
Copied
Hi Chaps,
I have a DreamWeaver recordset:
mysql_select_db($database_conndb2, $conndb2);
$query_rsProjects = "SELECT tbl_projects.projid, tbl_projects.projtitle, tbl_customers.custname, tbl_projects.projstart, tbl_projects.projdue, tbl_projects.projstatus, tbl_projects.projstatus, DATE_FORMAT(tbl_projects.projstart, '%d/%m/%Y') as projstart_format, DATE_FORMAT(tbl_projects.projdue, '%d/%m/%Y') as projdue_format, tbl_projects.projpriority FROM tbl_projects, tbl_customers WHERE tbl_projects.FK_custid=tbl_customers.custid AND tbl_projects.projstatus!='Complete' ORDER BY projid ASC";
$rsProjects = mysql_query($query_rsProjects, $conndb2) or die(mysql_error());
$row_rsProjects = mysql_fetch_assoc($rsProjects);
$totalRows_rsProjects = mysql_num_rows($rsProjects);
The data is presented in a table:
<table border="0" cellpadding="0" cellspacing="0" id="tblrepeat_proj">
<caption>
<img src="../Images/project.jpg" border="0" /><a href="project_add.php"><img src="../Images/new.jpg" border="0" /></a><a href="#" onclick="print()"><img src="../Images/print.jpg" border="0"/></a>
</caption>
<tr>
<th scope="col">Order No.</th>
<th scope="col">Document Name</th>
<th scope="col">Customer</th>
<th scope="col">Start Date</th>
<th scope="col">Due Date</th>
<th scope="col">Status</th>
<th scope="col">Edit</th>
<th scope="col">Remove</th>
</tr>
<?php do { ?>
<td>
<?php echo $row_rsProjects['projid']; ?></span></td>
<td><a href="project_details.php?id=<?php echo $row_rsProjects['projid']; ?>"><?php echo $row_rsProjects['projtitle']; ?></a></td>
<td><?php echo $row_rsProjects['custname']; ?></td>
<td><?php echo $row_rsProjects['projstart_format']; ?></td>
<td><?php echo $row_rsProjects['projdue_format']; ?></td>
<td><?php echo $row_rsProjects['projstatus']; ?></span></td>
<td><a href="project_edit.php?id=<?php echo $row_rsProjects['projid']; ?>">Edit</a></td>
<td><a href="project_remove.php?id=<?php echo $row_rsProjects['projid']; ?>" onclick="tmt_confirm('Are%20you%20sure%20you%20want%20to%20delete%20this%20record?');return document.MM_returnValue">Remove</a></td>
</tr>
<?php } while ($row_rsProjects = mysql_fetch_assoc($rsProjects)); ?>
</table>
Is it possible to use the table headings as the control for the ORDER BY in the SQL query?
You can, but I find it usually more user friendly to use client side sorting for tables. It's much faster and easy to implement. Just search for client side table sort. Here's one example.
http://www.glendinning.org/webbuilder/sortTable/
Copy link to clipboard
Copied
You can, but I find it usually more user friendly to use client side sorting for tables. It's much faster and easy to implement. Just search for client side table sort. Here's one example.
http://www.glendinning.org/webbuilder/sortTable/
Copy link to clipboard
Copied
That's exactly what I'm after . . .I'll try and use something like that,
thanks
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more