title: parts of HTML static, others dynamic - PHP or HTML - best way to lookup database
body: <p>I am creating a website for products. I am wondering: is it better to use a single dynamic page using PHP, or generate an HTML page for every product, updating the pages from a php template file in a cron job? Most of the material on the page (eg. basic product information) will not change over time , but other parts of the page will be generated from database lookups (inventory, reviews, etc.)</p>
  
  <p>I have heard some people arguing that it is better to have static url's (eg. category/product1.html) instead of dynamic ones (eg. products.php?id=1234) for SEO purposes. The problem I found with the former method is that it seems inconvenient to do database lookups from an HTML page. The way I implemented it was using javascript->php:</p>
  
  <pre><code>&lt;script type="text/javascript" src="http://localhost/inv_lookup.php?UPC=&lt;?php echo $UPC; ?&gt;"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>But then in the PHP file, you have to print javascript-formatted text:</p>
  
  <pre><code>    echo "document.write(\"" . $field . " : &lt;b&gt;" . $row[$i] . "&lt;/b&gt; &lt;br/&gt; \")"; 
  </code></pre>
  
  <p>This kind of DB lookup seems sloppy to me. Any suggestions?</p>