Jump to content

waterssaz

Members
  • Posts

    111
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Female
  • Location
    Carlisle,England

waterssaz's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. All that snippet of code essentially does is select one of the files from the array at random everytime the page is called, so yes it would change when the page is refreshed and on each visit, although due to the nature of random and depending on how many files you specify this may sometimes stay the same. The files can contain whatever code you want, Regards Sarah
  2. Ok, can't say I've actuallly tried this with jut php before but I could think of a few ways that should work, some will be more graceful than others. One to try then, How about an array of files that you want to include and then use something like <?php $files = array("file1.html", "file2.txt", "file3.php", "file4.php"); $rand = array_rand($files); include ($files[$rand]); ?> You could include this in on each page or to make it more portable incase you change the array, include it in a class file or function and call it from there. Forgive any syntax errors as I haven't tested it Hope it helps Regards Sarah
  3. Are you trying to create some kind of dynamic footer I take it but purely with PHP?
  4. You mean you want to count how many occurences of each there are? If so just do a simple GROUP BY query For example Select ID, COUNT(ID) from [YOUR_TABLE_NAME] GROUP BY ID or in PHP you can use the function array_count_values(array) Hope either of these helps :-) Regards Sarah
×
×
  • 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.