title: json_encode returning null
body: <pre><code>echo json_encode(array(utf8_encode("success")));
  </code></pre>
  
  <p>that code is returning null, I am trying to debug a project and would like it to return a post variable, but it won't even work with a string</p>
  
  <p>heres the full code:<a href="http://www.bludevelopment.com/php/getdata.txt" rel="nofollow">http://www.bludevelopment.com/php/getdata.txt</a></p>
  
  <p>The problem is in the uploadinstalldata function.
  The app calls it separately for each function.</p>
  
  <p>Any help is much Appreciated!</p>
  
  <pre><code>function uploadInstallData(){
  
  if (isset($_POST["Timestamp"]) &amp;&amp; isset($_POST["PMINo"]) &amp;&amp; isset($_POST["GPS"])){
  //$result = array(utf8_encode('value', 'success'));
  
  
  if ($_POST['cmd'] == "uploaddata"){
  
  $con = mysql_connect("localhost","bludevel_PMI","password1");
  if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
  
  mysql_select_db("bludevel_PMIForm", $con);
  
  $sql="INSERT INTO JobData (startTime, PMINo, Address, BeforePhoto, ExtraPhoto1,                    ExtraPhoto2, ExtraPhoto3, AbletoInstall, InstallProblem, BBoxStatus,
  NewLocation, BBoxPhoto, Occupied, BasementFinished, BuildingType, ServiceSize,     ServiceType, HousepipeSize, HousepipeType, SSControlValve, NewMeter,
  NewMeterSize, NewTransmitter, MIULocation, MeterInstallType, MtrLocated, MtrDirection1,   MtrSideof1, MtrDistance, MtrDirection2, MtrSideof2, AccessNotes,
  BldgWidth, BldgDepth, Review, StreetValve, HouseValve, AuthorizedWork, InspectorsName,   NewStreetValve, AddPiping, Installedby, AfterPhoto, AfterPhoto2,
  CustomerIncentive, ConfirmSignal, InstallNotes, EndTime, GPS)
       VALUES
             ('".$_POST[Timestamp]."',
              '".$_POST[PMINo]."',
          '".$_POST[Address]."',
              '".$_POST[BeforePhoto]."',
              '".$_POST[ExtraPhoto1]."',
              '".$_POST[ExtraPhoto2]."',
          '".$_POST[ExtraPhoto3]."',
          '".$_POST[AbletoInstall]."',
          '".$_POST[InstallProblem]."',
          '".$_POST[BBoxStatus]."',
          '".$_POST[NewLocation]."',
          '".$_POST[BBoxPhoto]."',
          '".$_POST[Occupied]."',
          '".$_POST[BasementFinished]."',
          '".$_POST[BuildingType]."',
          '".$_POST[ServiceSize]."',
          '".$_POST[ServiceType]."',
          '".$_POST[HousepipeSize]."',
          '".$_POST[HousepipeType]."',
          '".$_POST[SSControlValve]."',
          '".$_POST[NewMeter]."',
          '".$_POST[NewMeterSize]."',
          '".$_POST[NewTransmitter]."',
          '".$_POST[MIULocation]."',
          '".$_POST[MeterInstallType]."',
          '".$_POST[MtrLocated]."',
          '".$_POST[MtrDirection1]."',
          '".$_POST[MtrSideof1]."',
          '".$_POST[MtrDistance]."',
          '".$_POST[MtrDirection2]."',
          '".$_POST[MtrSideof2]."',
          '".$_POST[AccessNotes]."',
          '".$_POST[BldgWidth]."',
          '".$_POST[BldgDepth]."',
          '".$_POST[Review]."',
          '".$_POST[StreetValve]."',
          '".$_POST[HouseValve]."',
          '".$_POST[AuthorizedWork]."',
          '".$_POST[InspectorsName]."',
          '".$_POST[NewStreetValve]."',
          '".$_POST[AddPiping]."',
          '".$_POST[Installedby]."',
          '".$_POST[AfterPhoto]."',
          '".$_POST[AfterPhoto2]."',
          '".$_POST[CustomerIncentive]."',
          '".$_POST[ConfirmSignal]."',
          '".$_POST[InstallNotes]."',
          '".$_POST[EndTime]."',
          '".$_POST[GPS]."')";
  
  
  echo json_encode(array(utf8_encode("success")));
  return true;
  $res = mysql_query($sql);
  if (!res)
    {
    die('Error: ' . mysql_error());
    }
  
  if (!$mysql-&gt;error) {
  }
  
  mysql_close($con);
  }
  }}
  </code></pre>