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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:49:58+00:00 2026-05-23T01:49:58+00:00

I have data that I want to pull from a mySQL database and I

  • 0

I have data that I want to pull from a mySQL database and I want to sort it in an organized way so I can pull it later. I want to sort it in a matter where i have CompanyID $companyid: productID $productid: productName = $Product, industryName = $industry etc

so essentially I want to have:

  • CompanyID 1: ProductID 1: all the
    info about that specific product
  • CompanyID 1: ProductID 2: all the
    info about that specific product
  • CompanyID 1: ProductID 3: all the
    info about that specific product

  • CompanyID 2: ProductID 1: all the
    info about that specific product

  • CompanyID 2: ProductID 2: all the
    info about that specific product

etc etc

this is the while loop that pulls all the info, and where i will be storing it in either a multi-dimensional array or some object oriented class in PHP. either way, i’m not too sure how to go about doing it.

while ($row = mysql_fetch_array($result)){ 
                $CompanyName=$row['CompanyName'];
                $companyid=$row['companyid'];
                $Product=$row['Product'];
                $productid=$row['productid'];
                $Industry=$row['Industry'];
                $Link=$row['Link'];
                $Keywords=$row['Keywords'];
                $region=$row['region'];}

EDIT: I want to write a multi-dimensional array to capture all the data in an orderly manner. how would I go about writing that or is that even the best solution?

EDIT: right now i have this in the while loop:

 $companyIDArray[$companyid] = $productidArray[$productid] = $productInfoArray["CompanyName"]=$CompanyName;

and I am going to make one for each field. Is that the best way to do it?

  • 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-23T01:49:59+00:00Added an answer on May 23, 2026 at 1:49 am
     $data = array();
        while ($row = mysql_fetch_array($result)){ 
    
                    $Industry=$row['Industry'];
                    $Link=$row['Link'];
                    $Keywords=$row['Keywords'];
                    $region=$row['region'];}
    
     $data[$row['CompanyName'][$row['companyid']] = 
             array($row['Product'],$row['productid'], $Industry,$Link,$Keywords,$region );
    
    
    }
    
    print_r($data,true);
    

    the above is untested code but it will give you an idea atleast how to do it.

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

Sidebar

Related Questions

I have some data that I want to store somewhere in my Rails app
I have a file of about 30000 lines of data that I want to
I have some data. I want to go through that data and change cells
I have image data and i want to get a sub image of that
I have a factory class that populates objects with data. I want to implementing
I have YAML data that looks sort of like this, but ~150k of it:
Basically, I have multiple URL's stored in a MySQL table. I want to pull
We have a database that has grown to about 50GB and we want to
I want to pull large amount of data, frequently from different third party API
What is the best way for an app to push and pull data from

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.