0

I tried looking for this, but couldn't quite find the solution I was looking for.

The code below works:

$tpuserdata = mysql_query("SELECT name, tone_profile.uid, aall FROM users INNER JOIN tone_profile ON users.uid = tone_profile.uid")
or die(mysql_error());

while($tpuserinfo = mysql_fetch_array( $tpuserdata )) 
{
  $tpans = $tpuserinfo['aall'];

  echo $tpuserinfo['name'];
  echo " " . $tpuserinfo['uid'];
  echo " " . $tpans;

  echo "<br>";
}

However, the value of 'aall' or $tpans is an array. I have tried several different ways to implode the array, but everything I've tried either throws an error or simply returns "Array". Any help would be greatly appreciated!

ehart
  • 13
  • 4
  • How are you actually storing the 'array' in the first place? If you're just handing it to your database as an array, it'll be cast to a string with a value of `Array`. If you want to store an array in a database, you'll need to serialize it, and you'll need to unserialize it any time you retrieve it. You can get help with that here -> http://stackoverflow.com/questions/1978438/save-php-array-to-mysql – Crisp Mar 23 '14 at 07:51

1 Answers1

0

The value of $tpuser['aall'] can't be an array as there is no such type (array) in MySQL.

I think you want to use explode().

First use var_dump($tpans); below $tpans = $tpuserinfo['aall']; so you know what's in it.

Loïc
  • 11,804
  • 1
  • 31
  • 49