Q:
Describe how to create a simple AD rotator script without using database in PHP.
Answer
Following are the steps to create a simple AD rotator script without using database in PHP:
- All the ad’s can be collected in one place and be displayed randomly.rand() function can be used for this purpose.
- In order to NOT use any database, a flat file can be used to store the ad’s.
- In order to store the Ad’s information (HTML code), a flat file say “ad.txt” can be created.
- The random number can be stored in a variable
$result_random=rand(1, 100);
- Conditions can be checked to display the ad’s.
if($result_random<=70)
{
echo "Display ad1";
}
View answer
Workspace
Report Error
Discuss