Forum Moderators: open
In general, my idea is that the affiliate's page code would look something like this:
<P>Buy this book for $<some script looking up the price for item=238749288></P>
One idea is that each affiliate could install a PHP or Perl script that queried the database, but I think for that to happen the script would need the login for the database which is an obvious security problem. So unless I'm missing something that wouldn't work.
Another idea is to have a Javascript get the data, but I thought Javascript couldn't access databases. Then again, Google delivers its Adsense content with Javascript somehow, so maybe this is the path to take?
It is straight forward to implement. Your affiliates, provided that they know the product ID simply create HTML almost exactly as you suggest:
<p>Our Price: <script src='http://www.example.com/getprice.php?item=238749288' /></p>
That's all the affiliate needs to do. Now, on the merchant's server (www.example.com), the script getprice.php simply returns the header "Content-Type: text/javascript", performs a database query to get the price for item requested and then outputs something like:
document.write("USD 34.99");
That's basically it! I'm just using PHP as an example of course, it would be straight forward using any scripting language or server side dynamic page technology that you or your developers has available.
Incidentally, while poking around I discovered that MySQL users can be set up to have browse access to a database but not write access. So allowing affiliates to access the database directly would also have been an option, had <script src> not been even easier.