Jump to content

Laamgat

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Laamgat's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm working on a script that will display a random image each week.  The script calls for a random number, but I don't ever want the number to be the same after being executed twice.  So, I've tried while loops and do-while loops and every time, the script just freezes and continues to loop continuously. [code]<?php // Get current week number.  Assign to a variable. $current_week = date("W"); // Open up and read current_week.txt.  Assign to a variable. $previous_week_array = file("current_week.txt"); $previous_week = $previous_week_array[0.1]; // Open up and read current_shirt.txt.  Assign to a variable. $current_shirt_array = file("current_shirt.txt"); $current_shirt = $current_shirt_array[0]; if ($current_week > $previous_week) { $random_number = mt_rand(1,7); while ($randon_number = $current_shirt) $random_number = mt_rand(1,7); } echo $random_number; ?>[/code] Can anyone tell me why this is happening?
×
×
  • 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.