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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:39:36+00:00 2026-05-16T05:39:36+00:00

$result = $mysql->callSP(‘STOREDPE1’,$in); $arr_tmp=array(); foreach ($result[‘record’] as $rows) { echo one value; if(!empty($rows)){ echo

  • 0
$result = $mysql->callSP('STOREDPE1',$in);
    $arr_tmp=array();
    foreach ($result['record'] as $rows) {
        echo "one value";
        if(!empty($rows)){
            echo "Two Value";
            $arr_tmp[$rows['field1']] = $rows['field2'];
        }
    }

    return $arr_tmp;    

When I say var_dump($result) it has two values in array. But when I Execute arr_tmp it is returned with one value.

out put of “var_dump($result)`

 ["param"]=>
  array(4) {
    ["whcode"]=>
    string(5) "001"
    ["mode"]=>
    string(1) "A"
    ["stock_type"]=>
    string(4) "AAA"
    ["process_name"]=>
    string(7) "AAAA"
  }
  ["record"]=>
  array(2) {
    [0]=>
    array(3) {
      ["Field1"]=>
      string(5) "value1"
      ["Field2"]=>
      string(1) "CCC"
      ["Field3"]=>
      string(4) "BCC"
    }
    [1]=>
     [0]=>
    array(3) {
      ["Field1"]=>
      string(5) "value1"
      ["Field2"]=>
      string(1) "CCC"
      ["Field3"]=>
      string(4) "BCC"
    }
  }
}

output of var_dump (arr_tmp)

[1]=>
     [0]=>
    array(3) {
      ["Field1"]=>
      string(5) "value1"
      ["Field2"]=>
      string(1) "CCC"
      ["Field3"]=>
      string(4) "BCC"
    }

Both the array values seems  to be same 

I have the values overwriting in the array

  • 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-16T05:39:36+00:00Added an answer on May 16, 2026 at 5:39 am

    Very hard to understand and read with the bad formatting, please take care to post it with proper formatting.

    I think the answer is this:

    $result = $mysql->callSP('STOREDPE1',$in); 
    $arr_tmp=array();
    foreach ($result['record'] as $rows) { 
        echo "one value"; 
        if(!empty($rows)){ 
            echo "Two Value"; 
            $arr_tmp[][$rows['field1']] = $rows['field2']; 
        } 
    }
    
    var_dump($arr_tmp);
    

    That should store both sets of data, you just needed to make it a multi-dimensional array. That is, if that is your question and I did not mis-read it through that garbled text above.

    Update

    This option is not recommended better to learn how to use arrays, simply posted for an example of usage:

    $result = $mysql->callSP('STOREDPE1',$in); 
    $arr_tmp=array();
    $i=0;
    foreach ($result['record'] as $rows) { 
        echo "one value"; 
        if(!empty($rows)){ 
            echo "Two Value"; 
            $arr_tmp[][$rows['field1'] . "_$i"] = $rows['field2']; 
        }
        $i++; 
    }
    
    var_dump($arr_tmp);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to set default VALUE in SubQuery result using mysql SELECT p.`id`, p.`name`, p.`class_name`,
What is the easiest way to turn a mysql result variable into a multidimensional
Possible Duplicate: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result I'm getting
Possible Duplicate: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result I am
I'm currently searching for a possibility to order a mysql result by weights that
here is my code i am using to fetch mysql result from 4 different
How do I store a MySQL query result into a local CSV file? I
Normally when I want to query large result set using Mysql I write this
I have the following PHP/MySQL code: function executeMultirowQuery($query) { $result = mysql_query($query); $table =
Assume I have the following result set from a mysql DB call (basic example,

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.