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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:25:34+00:00 2026-06-08T05:25:34+00:00

i need help. i was developed a page in smarty , i got a

  • 0

i need help. i was developed a page in smarty , i got a result set from a query and i need to change the result set to string and stored in text area

my query is given below

select val from test

my result set is print in var_dump in controller

{ [0]=>  array(1) { ["val"]=>  string(1) "c" } [1]=>  array(1) { ["val"]=>  string(3) "c++" } [2]=>  array(1) { ["val"]=>  string(4) "java" } [3]=>  array(1) { ["val"]=>  string(3) "PHP" } }

i need to change in to sting like c,c++,java,PHP

the changing function is preformed only controller

ple help me.. and thk adv

  • 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-08T05:25:36+00:00Added an answer on June 8, 2026 at 5:25 am

    Use foreach for that. See more information here – http://php.net/manual/en/control-structures.foreach.php .

    Example –

    $array = Array("333", "222", "111");
    
    foreach($array as $string) {
        echo $string.'<br />';
    }
    

    Another solution would be to use implode.

    See more information here – http://php.net/manual/en/function.implode.php and again a small example –

        $array = Array("333", "222", "111");
    
        $strings = implode(",", $array); // comma in first quotes are seperator, you can set it also to " " for a single space.
    
        echo $strings; // In this case it will output 333,222,111 if you would set it to empty space then it would output 333 222 11
    

    EDIT:

    For writing in file you must use file functions.

    Check this link – http://php.net/manual/en/function.file-put-contents.php

    example –

        // your file
        $file = 'sample.txt';
        $array = Array("333", "222", "111");
        // Add all strings to $content.
        foreach($array as $string) {
            $content .= $string.'<br />';
        }
        // write everything in file
        file_put_contents($file, $content);
    

    Suggestion:

    When you are writing SQL queries, I would suggest that you already now start learning to write them correctly, so they are easier to read.

    For example, your query –

    select val from test
    

    Could be changed to –

    SELECT `val` FROM `test`
    

    which is alot easier to read and understand.

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

Sidebar

Related Questions

Need help with a query that I wrote: I have three tables Company id
need help to create regular expression matching string www.*.abc.*/somestring Here * is wild card
Need help writing a script downloads data from google insight using c# this is
need help/guide for sql select query, I have 2 table stock and stock_history, in
I need some help: http://www.stansellelectric.com If you go to any page on this website
need help regarding USSD Gateway. I have to develop an app, which will directly
I need someone help. When I open https://developers.facebook.com/docs/reference/api/ and clicked https://graph.facebook.com/me/likes?access_token=blablabla , I got
I need some help! Please. I am trying to develop a very very simple
Need help, function getFamily() { FB.api('/me/family', function(response) { alert(JSON.stringify(response)); }); } With the above
Need help getting Ember-Data working with Zend Rest. At first, I'm familiar with Zend

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.