My company has asked me to create an ad system script for a few websites that we own. It shouldn't be too difficult, I'm just having some troubles with it.
Right now I have a mysql table set up with the ad information such as it's id, where the image is located, the url the image is suppose to link to, and the position on the page where it's to be set.
I have it set up so there are tokens in an html template in this format: [ad-pos:left-col1] :so it looks like this:
<table border="0" cellpadding="0" cellspacing="0"> <tr> <td> [ad-pos:left-col1]<br /> [ad-pos:left-col2]<br /> [ad-pos:left-col3]<br /> </td> </tr> </table>
left-col1, left-col2, and left-col3 of course being actual positions themselves. So in the database the position field for an ad in [ad-pos:left-col1] token would read left-col1 and so on.
What I want it to do is this:
If there is no ad in the database with that posistion it simply won't show anything in replace of the token. But if there is one ad or more it will replace the token with one of ads randomly.
I thought it would be a simple proceedure but i can't get it work. I know there's is probably nothing to it and I'll hate myself when someone shows me like four lines of code that do it, lol.
Like I said I probably confussed the crap out of you, so if anyone has any questions feel free to ask, Thanks in advanced!