View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Grouping results of a recordset

Thread began 11/27/2009 6:21 am by Banksie | Last modified 6/14/2013 6:46 pm by Banksie | 673 views | 2 replies

Banksie

Grouping results of a recordset

I'm using DA2.0.6 developing a php / MySQL site and have a recordset that pulls a list of locations from a clients list of places where they have depots:

SELECT DISTINCT tbldepots.depotName
FROM tbldepots
ORDER BY tbldepots.depotName

but now want to group and display those records in alphabetical blocks under separate tabs (in a spry tabbed panel section of the page) so all "A*" locations are under the A tab, Bs under B etc.

Currently the repeat region on the page contains all of the records A-Z in a standard do...while loop:

<?php do { ?>
<li><?php echo $row_rsDepots['depotName']; ?></li>
<?php } while ($row_rsDepots = mysql_fetch_assoc($rsDepots)); ?>

I've tried experimenting with strpos etc:

if (strpos($row_rsDepots['depotName'], "a") ===0) {
echo $row_rsDepots['depotName']; }

But am not quite getting it how I think it should be! Am I missing something so obvious at the moment? (can't see the wood for the trees syndrome!!)

Any ideas as to how I can do this without having to run separate recordsets with a WHERE clause to pick out the individual letters?

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...