Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5937705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:34:49+00:00 2026-05-22T15:34:49+00:00

So what I am trying to produce is something like this: Except, I do

  • 0

So what I am trying to produce is something like this:
enter image description here

Except, I do not want duplicates, when there is more than one sign, it becomes duplicated as well as re creating the “C” list view header. My SQL query is creating a column known as first_char which is holding the first character of one of the other columns…….below is my code:

<?php foreach ($data as $name=>$signs): ?>
    <!-- If name is not empty, create the header -->
        <?php if (isset($name) && !empty($signs)): ?> 
            <div data-role='collapsible-set' data-theme='d'>

                <h2>Username:&nbsp;<strong id="headerName"><?=$name?></strong></h2>

        <?php endif; ?>

    <?php endforeach; ?>
    <!-- for every sign, take the first char and create a list view -->
    <?php foreach ($signs as $char):
            $current_char = '';
            if ($char['first_char'] != $current_char){
                $current_char = $char['first_char'];
                echo '<ul data-role="listview" data-dividertheme="d" style="margin-top: 0;"><li data-role="list-divider">'.$current_char.'</li></ul><br>';
            }

            foreach ($signs as $sign):
                if($current_char == $sign['first_char'] and !empty($signs)):                           
    ?>

                    <div data-role='collapsible' data-collapsed='true' data-icon='arrow-l'>
                        <h3><?=$sign['sign_name']?></h3>
                        <div class='ui-grid-a'>                 
                            <div class="ui-block-a">
                                <div class="ui-bar ui-bar-d" style="height:25px;">
                                    <strong>Last Seen:</strong><strong id="text"><?=$sign['last_connected']?></strong>
                                </div>
                            </div>
                            <div class="ui-block-a">
                                <div class="ui-bar ui-bar-d" style="height:25px;">
                                    <strong>Resolution:</strong><strong id="text"><?=$sign['resolution_x'].'x'.$sign['resolution_y']?></strong>
                                </div>
                            </div>
                            <div class="ui-block-a">
                                <div class="ui-bar ui-bar-d" style="height:25px;">
                                    <strong>Group Name:</strong><strong id="text"><?=$sign['group_name']?></strong>
                                </div>
                            </div>
                            <div class="ui-block-a">
                                <div class="ui-bar ui-bar-d" style="height:25px;">
                                    <strong>Sign Number:</strong><strong id="text"><?=$sign['sign_id']?></strong>
                                </div>
                            </div>
                       </div>
                    </div>
            <?php endif; ?>
        <?php endforeach; ?>
    <?php endforeach; ?>

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:34:50+00:00Added an answer on May 22, 2026 at 3:34 pm

    This fixes the previous error and gets rid of the duplication. $current_char needed to be outside the foreach loop, and removed the 2nd foreach.

    <?php $current_char = '';?>
            <?php foreach ($signs as $sign):?>
                    <?php                       
                        if ($sign['first_char'] != $current_char){
                            $current_char = $sign['first_char'];
                            echo '<ul data-role="listview" data-dividertheme="b" style="margin-top: 0;padding-top: 3px;"><li data-role="list-divider">'.$current_char.'</li></ul><br>';                     
                        }
                    ?>
    

    The query used above for SQL was this:

    SELECT 
        user.username,
        groups.group_id, groups.group_name,  
        sign.last_connected, sign.sign_id, sign.sign_name, sign.resolution_x, sign.resolution_y, LEFT(sign.sign_name, 1) AS first_char
    FROM
        user
    LEFT JOIN(
        groups, sign
    )ON(
        user.user_id = groups.userID AND
        groups.group_id = sign.groupID
    )
    WHERE
        username = ? AND
        UPPER(sign.sign_name) BETWEEN "A" AND "Z"
        OR sign.sign_name BETWEEN "0" AND "9" ORDER BY sign.sign_name
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to produce something like this with JAXB: <person> <firstName>Foo</firstName> <lastName>Bar</lastName> <identities> <green
How can I produce something like this with Linq? I'm trying to work something
I have a very large defaultdict(dict) that looks something like this: data['w']['x']['y']['z']={'a':5,'b':10} I'm trying
In django, I'm trying to do something like this: # if form is valid
actually I thought I was trying something really simple. ControllerClassNameHandlerMapping sounded great to produce
I'm trying to produce a string using a NSDate category in this way: NSString*
I'm trying to produce this XML statement (minus the formatting and specific values): <swatchcolor
I'm trying to produce random integers (uniformly distributed). I found this snippet on an
I'm trying to produce a line chart using Flot, but I want the data
I'm new to javascript and was trying to refactor some code, clearly there's something

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.