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.)
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:
<script type="text/javascript" src="http://localhost/inv_lookup.php?UPC=<?php echo $UPC; ?>"></script>
But then in the PHP file, you have to print javascript-formatted text:
echo "document.write(\"" . $field . " : <b>" . $row[$i] . "</b> <br/> \")";
This kind of DB lookup seems sloppy to me. Any suggestions?