Jump to content

revolving text ads


sl333py

Recommended Posts

Hi,

 

Is this possible to do. I'm getting together a site which will be optimised for mobile phones. The site is just a list of offers from local business in my town.

 

What I need to do is get a script that revolves the text ads each time the page is refreshed (the top ad goes to the bottom). The text ads are real simple and people just scroll down them on their mobiles.

 

There's gonna be about 50 ads on the page. Is this hard to do? I really haven't a clue about this stuff so any help would be greatly appreciated.

 

Thanks

 

This is sample of what the text ads will look like.

 

---------------------------

 

Dog & Gun

2 for 1 Offer

Order any meal and get the

second absolutley free!

 

South Bar, Bristol

01295 829511

Valid Until 23.03.09

 

---------------------------

 

The Ship

2 for 1 Offer

Order any meal and get the

second absolutley free!

 

South Bar, Bristol

01295 123876

Valid Until 23.03.09

 

---------------------------

 

The Admiral

2 for 1 Offer

Order any meal and get the

second absolutley free!

 

South Bar, Bristol

01295 2676242

Valid Until 23.03.09

 

---------------------------

 

The Bell

2 for 1 Offer

Order any meal and get the

second absolutley free!

 

South Bar, Bristol

01295 2676242

Valid Until 23.03.09

 

---------------------------

Link to comment
Share on other sites

Yes this is totally possible and not hard to do if you know how.

 

But at the moment you haven't got a clue (as you have already stated) and it will be very difficult for you to communicate specific problems since you don't know what they are yet.

 

I would suggest you get yourself a basic php book like "php and mysql for dummies" (thats the one I have) and see where it takes you.

 

Hi,

 

Is this possible to do. I'm getting together a site which will be optimised for mobile phones. The site is just a list of offers from local business in my town.

 

What I need to do is get a script that revolves the text ads each time the page is refreshed (the top ad goes to the bottom). The text ads are real simple and people just scroll down them on their mobiles.

 

There's gonna be about 50 ads on the page. Is this hard to do? I really haven't a clue about this stuff so any help would be greatly appreciated.

 

Thanks

 

This is sample of what the text ads will look like.

 

---------------------------

 

Dog & Gun

2 for 1 Offer

Order any meal and get the

second absolutley free!

 

South Bar, Bristol

01295 829511

Valid Until 23.03.09

 

---------------------------

 

The Ship

2 for 1 Offer

Order any meal and get the

second absolutley free!

 

South Bar, Bristol

01295 123876

Valid Until 23.03.09

 

---------------------------

 

The Admiral

2 for 1 Offer

Order any meal and get the

second absolutley free!

 

South Bar, Bristol

01295 2676242

Valid Until 23.03.09

 

---------------------------

 

The Bell

2 for 1 Offer

Order any meal and get the

second absolutley free!

 

South Bar, Bristol

01295 2676242

Valid Until 23.03.09

 

---------------------------

Link to comment
Share on other sites

Hi Guys,

 

Thanks for the quick replies!

 

Yeah it was more a request for hire. Honestly it would just fry my brain even a simple script! It's taken me ages to learn dreamweaver badly!

 

Dif'rent strokes for dif'rent folks an all that jazz.

 

I just wanted to know whether it was possible. I'll check out the freelance forum did'nt see it first time.

 

Cheers.

Link to comment
Share on other sites

full php code for a random advert script

 

should get you going the right directions it uses an image but its easy to edit the html used for the ads

 

<?php
// database connection details
$db_host = "localhost";               // hostname of your MySQL server. You most likely don't have to change this
$db_name = "DATABASE NAME";      // database name
$db_user = "USERNAME";      // database user
$db_pass = "PASSWORD";  // database password
$db_table= "banners";                 // table name

// connect to the database
$db = mysql_connect($db_host,$db_user,$db_pass);
mysql_select_db ($db_name) or die ("Cannot connect to database");

// count how many banners we have
$query = mysql_query("select * from ".$db_table."");
$total = mysql_num_rows($query);

// lets create a random number
$random = (rand()%$total);

// retrieve the record number corresponding to the generated random number
$query = mysql_query("SELECT * FROM ".$db_table." LIMIT $random, 50");

while ($row=mysql_fetch_object($query))
    {
    echo"<img style=\"width:90%;margin:0 auto;border:none;\" src=\"$row->ban_image\" alt=\"$row->ban_text\"/>";
    $ban_view = $row->ban_views + 1;
    // update the 'times viewed' counter on the banner
    mysql_query("update ".$db_table." set ban_views = $ban_view where ban_id = $row->ban_id");
    }
    
?> 

Database structure

CREATE TABLE `banners` (
  `ban_id` int(11) NOT NULL auto_increment,
  `ban_image` tinytext NOT NULL,
  `ban_url` tinytext NOT NULL,
  `ban_text` tinytext NOT NULL,
  `ban_views` int(11) NOT NULL default '0',
  PRIMARY KEY  (`ban_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.