title: Connecting desktop app to online database via php
body: <p>I've read a lot of posts on this general subject but I still can't seem to figure it out.</p>
  
  <p>I'm building a Mac/PC desktop application. When a user first authorizes the app, I want to store their info in an online Mysql database. I'm using the JUCE library to call and handle a php file online which in turn handles the updating of the online database. On my desktop app:</p>
  
  <pre><code>String url = "http://www.syntorial.com/onlinePHPFileToCall.php?email=" + email + "&amp;computer=" + SystemStats::getComputerName();
  URL authURL(url);
  InputStream *input = authURL.createInputStream(true);
  String result = input-&gt;readString();
  </code></pre>
  
  <p>And the php file:</p>
  
  <pre><code>&lt;?php
  
  $result = "";
  
  $mysqli = new mysqli('localhost','username','password','dbname');
  
  if (mysqli_connect_errno())
  {
      $result = "connection failed";
  }
  else
  {
      $mysqli-&gt;select_db("UserInfo");
  
      $email = $_GET['email'];
      $computer = $_GET['computer'];
  
      $query = "UPDATE UserInfo SET computer = '$computer' WHERE email = '$email'";
  
      if ($queryResult = $mysqli-&gt;query($query))
      {
          $result = "true";
      }
      else
      {
          $result = "false";
      }
  }
  
  echo $result;
  ?&gt;
  </code></pre>
  
  <p>The result comes back "true" on my desktop app, but the information doesn't actually get saved into the database. If instead of</p>
  
  <pre><code>InputStream *input = authURL.createInputStream(true);
  </code></pre>
  
  <p>I use:</p>
  
  <pre><code>authURL.launchInDefaultBrowser();
  </code></pre>
  
  <p>it opens up the php file in a browser and everything works fine. Any ideas what I'm doing wrong?</p>