Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Old 01-24-2005, 05:22 PM   PM User | #1
Eckxmods
New Coder

 
Join Date: Jan 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Eckxmods is an unknown quantity at this point
Advertising Script

Hey guys, I was making an advertising script and I wanted to know a couple of things for it. Note, I am very new to MySQL and am learning as I go so excuse the stupidness.

1) There are 2 ways the advertising can be shown, as standard 468x60 wide banners and 160x600 tall banners. Now the script I have to display the banner uses the ORDER BY RAND() command. Is there a way I can filter out if the banner is a standard or a tall banner?

2) I also want to make a activate, deactivate, expired status. How can I go about making this in MySQL?

Any help would be GREATLY appreciated. Sorry if I have posted some stuff that have already been answered, I tried searching a bit before I posted.

Thanks again guys.
Eckxmods is offline   Reply With Quote
Old 01-24-2005, 11:24 PM   PM User | #2
anarchy3200
Regular Coder

 
anarchy3200's Avatar
 
Join Date: Mar 2003
Location: England
Posts: 261
Thanks: 0
Thanked 1 Time in 1 Post
anarchy3200 is an unknown quantity at this point
OK so for this you will need a couple of extra columns in your database.
So an example structure of columns i would use would be:

ID, Link, Size, Active, Expired

So the id would just be a default auto_increment so they all have their own id, this is standard for when you start manipulating the data as they need to have a unique id.
Link would be the link to the advert
Size, i would use this to determin the size of you image, you could either set it to 't' or 'w' to resemble tall or wide and then in your query put in a where statement:

WHERE `Size` = 't'

Which would then filter out any that are of the wrong dimensions.

I would use the active column as just a single integer of 1 or 0, if it is 1 then the image is shown, if it is 0 then the image is not o this would be included into the where:

WHERE `Size` = 't' AND `Active1 = '1'

For the expiry depending on how you want to do this you could either add the expired column and set it to 1 if you do not want the image to display any more:

WHERE `Size` = 't' AND `Active1 = '1' AND `Expired` = '0'

or you could set this as a date, e.g.
expired = 2005/01/24

WHERE `Size` = 't' AND `Active1 = '1' AND `Expired` < 'date(Ymd)'

This would make sure that the date is before the value in the Expired Column


Hope this helps and you have followed what i have said.
Good Luck , feel free to ask any more questions
__________________
Mike
anarchy3200 is offline   Reply With Quote
Old 01-25-2005, 03:00 AM   PM User | #3
Eckxmods
New Coder

 
Join Date: Jan 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Eckxmods is an unknown quantity at this point
Thank you very much for the info, I have made the module. Right now it filters if its a tall or a wide banner and shows ads randomly. I also can change the status to active, deactive, and expired on my administration pannel.

The last thing I need to do is make a system that will change the status of the banner to EXPIRED atuomatically. I have made a variable called $impressions which count how many times the banner has been loaded. The variable for the number of impressions the client has ordered is $purchasedimp.

My question is, how do i make the script so that if $impressions > $purchasedimp it changes the status to EXPIRED and shows a different banner. Basically I want the banner to expire after the banner has been showed the number of times the client paid for it to show. I have no idea how to go about this function.

I know that my questions are n00bish to you guys but I started PHP and MySQL just a month ago and this is my first officail project. Thanks again.

Last edited by Eckxmods; 01-25-2005 at 03:03 AM..
Eckxmods is offline   Reply With Quote
Old 01-25-2005, 04:45 AM   PM User | #4
Kiwi
Regular Coder

 
Join Date: Oct 2002
Posts: 379
Thanks: 0
Thanked 0 Times in 0 Posts
Kiwi is an unknown quantity at this point
Well, you would need to store that data in the database. You need a fields for 'purchasedimp' and 'impressions' linked to the banner's unique ID. When the banner is created, enter the 'purchasedimp' value. Each time the banner is loaded, you increment 'impressions': UPDATE table SET impressions=impressions+1 WHERE id=<selected banner>. Then add a criteria to your banner SELECT ... FROM table as A WHERE A.impressions < A.purchasedimp.
__________________
Strategy Conscious
Kiwi is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:14 PM.

Home - Contact Us - Archives - Link to CF - Resources - Top 

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.