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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:13:19+00:00 2026-05-27T21:13:19+00:00

hey guys is this even possible to be done in php <?php $sectorcount =

  • 0

hey guys is this even possible to be done in php

<?php   
$sectorcount = $row_SectorCount['COUNT(*)'];
//number of rows in database
for ($i = 1; $i <= $sectorcount; $i++)
{
${spendingname . $i}= array();
${spendingpercent . $i} = array();
${spendingid . $i} = array();

mysql_select_db($database_conn2, $conn2);
$query_Spending = "SELECT CONCAT(spending.SectorID, spending.ExpenditureID) AS 'SpendingID',
expenditure.ExpenditureName, spending.SpendingPercent, spending.SectorID
FROM spending   
INNER JOIN expenditure ON spending.ExpenditureID = expenditure.ExpenditureID
WHERE spending.SectorID = ".$i;
$Spending = mysql_query($query_Spending, $conn2) or die(mysql_error());
$totalRows_Spending = mysql_num_rows($Spending);
while($row_Spending = mysql_fetch_assoc($Spending))
{
${spendingname.$i}[] = $row_Spending['ExpenditureName'];
${spendingpercent.$i}[] = $row_Spending['SpendingPercent'];
${spendingid.$i}[]= $row_Spending['SpendingID'];
}
mysql_free_result($Spending);
}

i was planning to use this here in this context. having an array to draw out the values using a where clause and display them individually

  • 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-27T21:13:20+00:00Added an answer on May 27, 2026 at 9:13 pm

    This is what you are looking for:

    for ($i = 0; $i < 14; $i++) {
        ${'name' . $i} = $i;
    }
    
    echo $name3;
    

    But you should just use an array:

    $name = array();
    for ($i = 0; $i < 14; $i++) {
        $name[$i] = $i;
    }
    
    echo $name[3];
    

    If you need an array in an array, go ahead and do that too. If you need more nested arrays than that, you should probably be using a class somehow instead of all that array nesting.

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

Sidebar

Related Questions

Hey guys im using the method above like: string = [array componentsJoinedByString:@\n]; this prints
Hey Guys my goal for this multi dimensional array is to document the answers
Hey guys, this is simple but I can't make it workn... blah! I have
Hey guys, hope this isn't too much of a n00b question I'm mainly a
Hey Guys, here is my code for this, the only help i get from
hey guys im working on a task to make my story's links like this
Hey guys, I want to store a categorized list of URLs. This is an
Hey guys, I'm using Twitter's PHP API, called twitterlibphp , and it works well,
Hey guys, I've spent hours looking at this, and am hoping a fresh pair,
Hey guys this thing drives me crazy. I defined in my stylesheet: ul#menuCnt li

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.