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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:46:03+00:00 2026-06-13T02:46:03+00:00

I want to explode an array, read each value and print them back in

  • 0

I want to explode an array, read each value and print them back in an array…

I dont understand where i am getting wrong. Please help me..this is my code..

I am getting an array to string conversion error

$query="SELECT categories FROM shops";
$result = mysql_query($query);  
while($column = mysql_fetch_assoc($result)){
    $categories=explode(",",$column['categories']);
    foreach($categories as $value){
        $new_query="SELECT name from categories where id='$value'";
        $name = mysql_query($new_query);    
        $name_column= mysql_fetch_assoc($name);
        array_push($shops_list,$name_column);

    }
}
echo implode(",",$shops_list);
  • 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-13T02:46:04+00:00Added an answer on June 13, 2026 at 2:46 am

    $shop_list is not defined, before using it in this line array_push($shops_list,$name_column);. And, this line

        array_push($shops_list,$name_column);
    

    needs to be, as you need to mention the key name,

        array_push($shops_list,$name_column['name']); //or better
        $shop_list[] = $name_column['name'];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a huge text file which I want to explode into an array.
If I want to explode a string by parts in PHP into an array,
I have a string category=45&format=1 that I want to convert into a key=value array.
Anyone know what I'm doing wrong? From the following array I want to count
I have tried to explode the returned array and it just doesn't want to
I've created an array of cities $cities = explode(|, $city); Now I want to
i want to create a button/menu in title bar on each windows explore(or in
want to know why String behaves like value type while using ==. String s1
I have an array $rows where each element is a row of 15 tab-delimited
I want to change the format of this array to match another one. One

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.