Results 1 to 2 of 2

Thread: exploring random numbers

  1. #1
    Join Date
    Mar 2007
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default exploring random numbers

    hi..its me again..
    i hv a table for question which has id labelled from 1 and it keeps growing..
    i want to generate random number but only from those numbers which hv level "easy"..
    id 1 cud hv level easy while 2 has hard and 3 has medium again 5 has easy..
    how do i do tht?
    thanks in advance

  2. #2
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    ?
    PHP Code:
    <?php
    if ($lev "easy") {
    $num rand();
    } elseif (
    $lev "medium") {
    $num 1234;
    } elseif (
    $lev "hard") {
    $num 5678;
    } else {
    echo 
    "invalid level";
    ?>
    php.net has examples of all their functions...

    Also, please use have and could, make an effort to use language that cam be interpreted by people who don't speak english natively.
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •