title: How to connect my unity project to mysql server on ec2 instance
body: <p>I am trying to get data from my MySQL server to my Unity project. I tried to get the data like so:</p>
  
  <pre><code>public string awsurl = "ec2-174-129-82-141.compute-1.amazonaws.com/connect_to_server.php";
  IEnumerator GetScores()
  {
          print("get scores start");
          WWW aws_get = new WWW(awsurl);
          yield return aws_get;
          print("getscore here");
          if (aws_get.error != null)
          {
              print("There was an error getting aws: " + aws_get.error);
          }
          else
          {
              print(aws_get.text); // this is a GUIText that will display the scores in game.
          } 
  }
  </code></pre>
  
  <p>I have a php script on my server to handle the interaction because I am having trouble using the MySqlConnection library for my unity project. 
  Here is my php script:</p>
  
  <pre><code>    $address = "localhost"
  $dbusername = "root";
  $dbpassword = "root";
  $db_name = "watshoes";
  $db_conn = new mysqli($address, $dbusername, $dbpassword, $db_name);
      if(isset($_POST['username'])) $username = $_POST['username'];
      if(isset($_POST['user_id'])) $user_id = $_POST['user_id'];
      if(isset($password)) $password =$_POST['password'];
  
      $stmt = $db_conn-&gt;prepare("SELECT image FROM ImageText");
      // "s" means the database expects a string
      $stmt-&gt;bind_param("s", $user_id);
      if($stmt-&gt;execute())
      {
          /* bind result variables */
          $stmt-&gt;bind_result($image);
          /* fetch value */
          $stmt-&gt;fetch();
          echo $image;
      }
      else
      {
          echo "query failed";
      }
      $stmt-&gt;close();
      $db_conn-&gt;close();
  </code></pre>
  
  <p>But every time I run the code I get this error:<code>There was an error getting aws: Failed to connect to ec2-174-129-82-141.compute-1.amazonaws.com port 80: Timed out</code></p>
  
  <p>Thanks for looking at the code and please let me know if there is anything else I can do to help.</p>