title: Issue running PHP code after Javascript
body: <p>Basically, this is what I am doing:
  I have a flash/ajax file uploader where users can select x amount of photos and upload them and then they are inserted into a MYSQL database by an external php script. </p>
  
  <p>After they are inserted in the  database, I would like to display them on the page and allow the users to edit the tags, caption, etc. </p>
  
  <p>However, I cannot figure out how to "Live update" the page to display the correct data</p>
  
  <p>Take this for example:
  showFields() is ran once he upload is complete;</p>
  
  <pre><code>function showFields() {
  
       var jsvar = '&lt;?php echo getIDs(); ?&gt;';
  
       document.getElementById('picndata').innerHTML += jsvar;    
  }
  </code></pre>
  
  <p>which will work if I have getIDs just return a static value such as "test"</p>
  
  <p>but if i were to have it do this:</p>
  
  <pre><code>function getIDs() {
  
      $SQL = "SELECT * FROM `slides` ORDER BY `sid` DESC";
      $results = mysql_query($SQL);
      $row = mysql_fetch_assoc($results);
      $slide = $row['sid'];
  
      $SQL = "SELECT * FROM `slides` WHERE `sid` = $slide";
  
      $results = mysql_query($SQL);
      $str;
  
      while ($row = mysql_fetch_array($results)) {
          $str .= $row['size'] . "\r\n";
      }
  
      return $str; 
  }
  </code></pre>
  
  <p>(sloppy I know)</p>
  
  <p>, then it will not work because the PHP is ran first and so it does not find any results because the images were not uploaded yet!</p>
  
  <p>Any ideas?</p>