Jump to content

crazzypappy

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

crazzypappy's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry for the delay in replying back , been working :-( anyways yep that fixed it thanks for your help.
  2. no the mph comes from a sql table the original script that does give a result is if ( $racer == 'chris' ) { $fuel = rand(5,12); $raced = "Chris"; $speeds = "20"; $ra = "1"; $percent = mph/$speeds*100; $nextrace = time()+120; $reps = rand(500,1200); $mns = rand(200,1500); } but what happens is if mph is like 300 it would give me a result larger than 100 % and i want to limit the ansver no greater than 100
  3. Ok heres what i want to do i have a race script and would like to work out the chances of beating each person car speed vs car speed , the script give mph for both users i have worked out how to show a percentage but sometimes its showing 200 % so i want to do is create an if - elseif to limit the percentage shown as 100% this is what i have got so far but it is giving me errors else { if ( $_GET['race'] ) { $racer = $_GET['race']; if ( $racer == 'chris' ) { $fuel = rand(5,12); $raced = "Chris"; $speeds = "20"; $ra = "1"; $percent = mph/$speeds*100; $Percent2 = $percent; $nextrace = time()+120; $reps = rand(500,1200); $mns = rand(200,1500); //this is the section im having trouble with $percent3 = (if ($percent >= 100){ echo "100" } elseif ($percent < 100){ echo $Percent2}) } elseif ( $racer == 'jon' ) { Thanks for any help you can offer
  4. The array, unless you have a special case for each word but it seems like you just want to check to see if the input is in the list, and if it is, use it in the search. If that's the case, the array is better. each word is for a corresponding column in the database , the words from the column are displayed in another page so as to let the user know what words they have so far ! anyways this gives me a better understanding and ill research some more as well
  5. ok thanks heaps ill give that a try and see how i go have got 20 words to check so which would be better the switch or the array ??
  6. ok well thats all good but how would i impliment it ?? please explain and or show a example, remember im new to this. this is as far as i have got <?php require_once('Connections/conn.php'); ?> <?php $uuser = $_SESSION['MM_Username']; $input = $_POST['word'] if ($input == "hello") {$SQL = "UPDATE phpbb_user SET gword1='$input' WHERE user='MM_Username'"; } elseif ($input == "choice") {$SQL = "UPDATE phpbb_user SET gword2='$input' WHERE user='MM_Username'"; } elseif ($input == "hatter") {$SQL = "UPDATE phpbb_user SET gword3='$input' WHERE user='MM_Username'"; } elseif ($input == "disk") {$SQL = "UPDATE phpbb_user SET gword4='$input' WHERE user='MM_Username'"; } else echo 'word not reconised, try again' ?> <form action="" method="post"><input name="word" type="text"><input name="" type="button"></form> so how would i transfer that into an array and where you said white did you mean while ?? sorry been looking at code and web pages for last 3 days trying to get this ! and have had many attempts
  7. hi all on my page i have a text input form , what i am after is how to input the word from the form into the right colom of the user table for the word that was input and if they type a word that is not in the lis of alowable word get an error message saying word not found ! my sudo code is using old php4 and mysql4.1 ( or somthing like that "phpdev" prog ) for testing on home computer with Apache ps total newbie with php/mysql
×
×
  • 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.