![]() | ![]() |
|
Welcome to the HEXUS.community discussion forums forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and other features. By joining our free community you will have access to post topics, respond to polls and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! |
| |||||||
| Software and web development Databases, graphics, programming, scripting and web development. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Agent of the System Join Date: May 2004 Location: South West UK (Bath)
Posts: 3,665
Thanks: 35
Thanked 62 Times in 45 Posts
| Simple Banner Script Javascript or PHP Advice Hello all. I'm looking at a possibility of putting together a small banner advertisment script thats VERY simple for a website I'm trying to put together (none proffit - and non comercial adds, hence why I ask) I have some basic PHP from a CMS that creates the following code
The part that interest me is
having a config file somthing linke ads.config
the code would then look like this
having a config file somthing linke ads.config
the code would then look like this
having a config file somthing linke ads.config
the code would then look like this
this is only the principal I'm trying to get my head around - and I'm only using javascript as an example I'd be happy to do something like include a php script that connects to a database and gets the data from a database table or flat file such as
thanks. It is Inevitable..... |
| | |
| | #2 (permalink) |
| Large Member Join Date: Apr 2004
Posts: 3,399
Thanks: 27
Thanked 28 Times in 23 Posts
| The easiest way I reckon is your database method. You want a script that generates a random number, and your db's advert table should include unique_key, image and url fields. The random number would be generated and your SQL statement would read SELECT * FROM adverts WHERE unique_key = '$random_number'. Of course your limitations here are assigning a max_value to to the random_number, you could increase it's value each time you add a new image/url to the database. The best solution however is to retrieve the metadata for the 'adverts' table which would return the no of rows, using this as your max_value. Of course this is all based on you wanting the the ad's random, and not in order, or not displaying the same ad twice etc. Good luck. To err is human. To really foul things up ... you need a computer. |
| | |
| | #3 (permalink) |
| Agent of the System Join Date: May 2004 Location: South West UK (Bath)
Posts: 3,665
Thanks: 35
Thanked 62 Times in 45 Posts
| funny enough this is pretty much identical to the way I went. I'll post the code once its finished. I just needed to look at it from a different angle thanks for your view It is Inevitable..... |
| | |
![]() |
| Breadcrumb | ||||||
| ||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP script errors after moving hosts.. | Stoo | Software and web development | 15 | 15-07-2004 12:31 AM |