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 6378487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:00:48+00:00 2026-05-25T02:00:48+00:00

In a database I’m working with, there are 6 columns with names: price1dollar price2dollar

  • 0

In a database I’m working with, there are 6 columns with names:

price1dollar
price2dollar
price3dollar
price4dollar
price5dollar
price6dollar

I thought that once I had the result set for the query, I could access it like so with PHP:

for($i = 1; $i <= 6; $i++) {
    echo $row['price'+$i+'dollar'].'<br />';
}

and that would print out all the values, but I’m not getting anything printed.

if I use:

echo $row['price1dollar'];

then the value is printed out fine.

I have echoed the value of $i and it prints out 1 to 6 fine, so I don’t know whats going on.

Is the $row['price'+$i+'dollar'] syntax not allowed?

Many thanks

  • 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-25T02:00:48+00:00Added an answer on May 25, 2026 at 2:00 am

    should be

    $row['price' . $i . 'dollar']
    

    in PHP there are . (dot) string connections (+ (plus) is i think for example in Java)

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

Sidebar

Related Questions

Database resources, that can be accessed from webpage that I'm currently working on, have
Database has tables Photos and PhotoAlbums. I need a query that will select all
My database project needs to include a SQL file with a command that will
Database is MySQL. I am looking to implement a trigger that updates an aggregate
Database: Document has many Sections, Sections has many Comments On each document page, there
Database has table X and tables An, Bn, Cn, Dn that inherits from X.
The database has a ton of entries that were not escaped because they were
My database contains records that have: 1) First line delimited with double \n\n and
Can database Ids be negative in SQL Server? I know that you can have
My database contains empty table columns. I would like to add a character like

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.