sl333py Posted March 18, 2009 Share Posted March 18, 2009 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 --------------------------- Quote Link to comment Share on other sites More sharing options...
samshel Posted March 18, 2009 Share Posted March 18, 2009 pl post some more details...some code/DB structure etc. if this is all that you have, then read some tuts to prepare basic PHP pages, make DB connection best of luck Quote Link to comment Share on other sites More sharing options...
sloth456 Posted March 18, 2009 Share Posted March 18, 2009 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 --------------------------- Quote Link to comment Share on other sites More sharing options...
laffin Posted March 19, 2009 Share Posted March 19, 2009 Very easy script to make. But this looks more like a business venture, than a request for help. If ya dun have the skills nor desire to learn, best place for this is in the Freelancing forum here Quote Link to comment Share on other sites More sharing options...
sl333py Posted March 19, 2009 Author Share Posted March 19, 2009 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. Quote Link to comment Share on other sites More sharing options...
dropfaith Posted March 19, 2009 Share Posted March 19, 2009 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 ; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.