|
||||||
| PHP Tutorials PHP Tutorials |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
||||
|
Simple banner rotator
Okay today I'm going to show you how to make a simple banner rotator... You can use it for your ads on your site
![]() First of all we must create tables to database: SQL Code:
Now we must start with our script.. PHP Code:
$SQLuser = ""; - your database username $SQLpass = ""; - your database password $DB = ""; - Database PHP Code:
mysql_select_db($DB) or die("Can not select database: ".mysql_error()); - It will select a database for you.. but if it can't select it will generate a detailed error ![]() Now let's find out how many banners we have in our database and let's generate a random number ![]() PHP Code:
$numTab = mysql_num_rows($query); - This will show us how many records are in our table Another 2 rows will generate a random number and they will select random banner. Now let's show our banner. PHP Code:
$banURL = $row['bannerurl']; - Banner's URL $banTXT = $row['bannertxt']; - Banner's text $Banner = $row['bannerimg']; - Banner itself $BanViews = $row['views']; - Banner's views $BanID = $row['id']; - Banner's ID echo"<a href='".$banURL."' target='_blank' title='".$banTXT."'><img src='".$banner."' alt='".$banTXT."' border='0'></a>"; - Shows the banner that was randomly chosen from the table $newViews = $BanViews+1; - Increases banner views by 1 mysql_query("UPDATE banner SET views = $newViews WHERE id = $BanID"); - Updates banner views And we are done Simple 'eh ![]() Okay here's the full script: PHP Code:
__________________
![]() ![]() CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | Freelance Need help? Send a PM Trill Network: Trill Designs | Trill Hosting |
|
||||
|
Re: Simple banner rotator
Makes sense to insert SQL code into the MySQL database, indeed.
__________________
Funny Stories and Humorous Pictures |
|
||||
|
Re: Simple banner rotator
![]() mysql database isnt a file ![]() it's a database.. it's like server.. ![]()
__________________
![]() ![]() CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | Freelance Need help? Send a PM Trill Network: Trill Designs | Trill Hosting |
|
||||
|
Re: Simple banner rotator
you can use this function also if you have permission..
BUT usually you are not permitted to do it.. so.. you must create databases in your Cpanel or phpMyAdmin
__________________
![]() ![]() CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | Freelance Need help? Send a PM Trill Network: Trill Designs | Trill Hosting |
|
||||
|
Re: Simple banner rotator
hmm.. you gave me an idea.. i'll create some tutorials about that
![]()
__________________
![]() ![]() CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | Freelance Need help? Send a PM Trill Network: Trill Designs | Trill Hosting |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Project: ionFiles - Joomla Simple File Download | Jordan | Community Projects | 369 | 01-30-2010 02:10 PM |
| A simple timer | travy92 | VB Tutorials | 2 | 01-22-2010 10:29 AM |
| Tutorial - A Simple Stropwatch! | travy92 | VB Tutorials | 19 | 05-04-2009 05:02 AM |
| implementing a simple database | martybell | Visual Basic Programming | 3 | 11-06-2007 05:25 PM |
| Banner ads | DevilsCharm | Marketing | 7 | 07-06-2006 12:33 PM |
All times are GMT -5. The time now is 08:16 AM.
Amrosama.cc
Arekbulski.cc
Debtboy.cc
Guest.cc
Jaan.cc
James.cc
Mathx.cc
Tsz.cc
Vswe.cc