title: Polymer and PHP
body: <p>Hi I am just beginning to learn Polymer. 
  I collect data as below using PHP. I can embed this in a DIV and display some data but I would like to make this bit of code into a Polymer element with parameters that I can import and the json data also into an external Polymer element that I can use to populate the page.
  I am struggling to get started, I know this is basic but if anyone has a pointer to get me on my way that would be great.</p>
  
  <pre><code>&lt;?php 
  $host="host";
  $username="username"; 
  $password="password"; 
  $db_name="database";
  $db_query="SELECT * FROM table"; 
  
  $mysqli = new mysqli("$host", "$username", "$password", "$db_name");
  if ($mysqli-&gt;connect_errno) {
      echo "Failed to connect to MySQL: (" . $mysqli-&gt;connect_errno . ") " . $mysqli-&gt;connect_error;
  }
  
  $mysqli-&gt;real_query("$db_query");
  $res = $mysqli-&gt;use_result();
  $rows = array();
  while ($row = $res-&gt;fetch_assoc()) {
      $rows[] = $row;
  }
  print json_encode($rows);
  
  ?&gt;      
  </code></pre>