• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PHP array question

I don't know why i'm having so much trouble with this. I did a sql select and my outcome is:

name => xxxxx for each row.

So I'm attempting to make a helper that would add:

value=> $row['name'] for each row, but I'm stuck.

I have:

foreach ($xArr as $row){
  $row['value'] =  $row['name']

but i know that's not right. any help?

Nevermind. I have to put it in by reference, or push it to a new array.

Use the result_array() function and var_dump() functions to see what your results look like, and then you can better see what exactly you need to do.

Other than that, your question as of now is unanswerable because we don't know what data $xArr contains.

Unless you are looking for this:

foreach ($xArr as $key => $value)

see above.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.