random number generator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    random number generator

    hi .i am looking for some code to generate a random number for users. this number will then be inserted to there profile .
    its the actual random number generating thats giving me the head ache . seen so many different codes on how to do it its confused me .

    Code:
    <?php
    $random = rand (1, 500)  
    echo" $random";
    ?>
    this is the simplest of the lot i have found but i cant get it to show the number on the page . am getting error on line 3.

    any help appreciated.
    Wapchat4u


    Topsites4u

    #2
    try now:

    PHP Code:
    <?php
    $random 
    rand(1500);  
    echo 
    $random";
    ?>
    Advertise your mobile site for FREE with AdTwirl

    Comment


      #3
      lol mate you beat me to it.

      thats the exact same code gum .? but the one below i just done works.
      cheers.


      Code:
      <?php
      $random = mt_rand(0, 500);  
      echo $random
      ?>
      Last edited by nclemale36; 25.07.12, 18:27. Reason: cos am stupid lol
      Wapchat4u


      Topsites4u

      Comment


        #4
        Originally posted by nclemale36 View Post
        thats the exact same code gum .?
        is the same code. gums just fixed the syntax error is all, whenever an error appears and tells you the line number of that error. you can be almost guaranteed that the error is on the line/lines above the line it says it has an error on. 99% of the time lol.

        for example. you said line 3 was popping off errors.
        your syntax problem was on line 2 missing a ; at the end of the line.
        <?php
        include ('Ghost');
        if ($Post == true) {
        echo '

        sigpic
        alt='coding-talk.com!!' />';
        echo 'Sharing Is Caring!';
        } else {
        echo '

        alt='the username GHOST has been comprimised!' />';
        echo 'OMG SOMEBODY HELP ME!!';
        }
        ?>

        Comment

        Working...
        X