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

  • Home
  • SEARCH
  • 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 9150643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:38:19+00:00 2026-06-17T11:38:19+00:00

I have a feeling I’m going to get scolded for this but here is

  • 0

I have a feeling I’m going to get scolded for this but here is the question.

$seq_numbers = range('1', '24');
foreach($seq_numbers as $seq_number) 
{
    Bullet <?php echo $seq_number;?>  
    // (this successfully creates - Bullet 1, Bullet 2, etc. - 
        below is the problem.

    <?php echo $db_rs['bullet_($seqnumber)'];?>
}   // this one doesn't work.  

I’ve tried
with curly brackets {}

I basically have a few columns that are named same except for number at the end (bullet_1, bullet_2, bullet_3, etc.) and want to get the results using a loop.

  • 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-06-17T11:38:20+00:00Added an answer on June 17, 2026 at 11:38 am

    Your problem is, that PHP doesn’t replace variables inside strings enclosed with single quotes. You need to use $db_rs["bullet_{$seq_number}"] or one of those:

    <?php
    foreach ($seq_numbers as $seq_number) {
       $key = 'bullet_' . $seq_number;
       echo $db_rs[$key];
    }
    

    Even shorter, but a little less clear:

    <?php
    foreach ($seq_numbers as $seq_number) {
       echo $db_rs['bullet_' . $seq_number];
    }
    

    An entirely different approach would be to loop over the result array. Then you don’t even need $seq_numbers. Just as an afterthought.

    <?php
    foreach ($db_rs as $key => $value) {
       if (substr($key, 0, 7) == 'bullet_') {
          echo $value;
       }
    }
    

    Oh…and watch out for how you spell your variables. You are using $seq_number and $seqnumber.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a feeling I'm going about this all wrong. But anyway. I have
I have the feeling the answer to this question is no but I figured
I have a feeling this is a stupid question but I can't find the
I have a feeling this answer is going to be very simple, but I
I have a feeling that this is stupid question, but I'll ask anyway... I
I have a feeling that this is a subjective question, but perhaps there's something
I have a feeling that this question is very simple, but I just can't
I have a feeling this question is a can of worms but I am
I have a feeling this is a rather trivial question, but I'm stumped. In
I have a feeling this is something very obvious that I'm missing, but here

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.