title: json_encode a MySQL table and urldecode Each Row
body: <p>Here's what I got. I have a MySQL table, in this case 'businesses' which has a many rows of urlencode() data. I am trying to use a php script (getTable.php) to grab the table urldecode() each row and then use a json_encode to send the data as an array back to javascript. Here's what i have so far.</p>
  
  <pre><code>$table = $_GET['table'];    
  $query = "SELECT * FROM $table";
  $jsonOut = array();
  while($result = mysql_fetch_array(mysql_query($query))) 
  {
      foreach($result as &amp;$value) 
       {
        $value = urldecode($value);
       }
  $jsonOut[] = $result;
  }
  echo (json_encode($jsonOut));
  </code></pre>
  
  <p>Obviously, I'm doing something wrong because I'm causing an infinite loop and nothing ends up working. Any help wold be greatly appreciated.</p>