Jump to content

corbo950

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

corbo950's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. ya is on my local machine that it is having problems and this is a rush job dont have time to fix it
  2. Ya the whole reason i had to post here is i cant get error reporting to to work so i cant debug it and the variables shouldnt be undefined because in the array they are nothing but strings
  3. The WHERE clause if for when you dont want to return all of the rows like if you only wanted to return people with a certain value in the table so if you want all of the values you dont want a WHERE clause
  4. I have a adobe AIR application and I wanted to add a login script to it. So this is what I came up with and I can't figure out why it wouldn't return anything(no error messages). Help would be much appreciated. <?php $dbhost = '127.0.0.1'; $dbuser = 'root'; $dbpass = '1111'; $dbname = 'flex'; $conn = sprintf("mysql_pconnect('%s', '%s', '%s')", $dbhost, $dbuser, $dbpass); if (!$conn) { exit("Unable to connect to DB: " . mysql_error()); } if (!sprintf("mysql_select_db('%s')", $dbname)) { exit("Unable to select mydbname: " . mysql_error()); } $users = cw_sql_query('SELECT * FROM volunteer_users'); while(list($pos, $user)=each($users)) { if($_REQUEST["username"]=$user["username"]) { if($_REQUEST["password"]=$user["password"]) { echo("1"); } else { echo("0"); } } else { echo("0") } } function cw_sql_query($info) { global $conn; $query = mysql_query($info); dump($query); $results = array(); while ($result = mysql_fetch_assoc($query)) { array_push($results, $result); } mysql_free_result($query); Return($results); } ?>
  5. This is a script designed to run a list of arithmetic functions. It is for a math game where one rolls 3 dice to get a number then roll them again to get 3 numbers that using roots, multiplication, addition, subtraction, division, and exponents. When I input the numbers I get back a blank page. Thanks to all who help. <?php $functions = array( "$a+$b+$c", "$a+$b-$c", "$a+$b*$c", "$a+$b/$c", "$a+$b^(1/$c)", "$a+$b^$c", "$a+^($b+$c)", "$a+^($b-$c)", "$a+^($a*$c)", "$a+^($b/$c)", "$a+^($b^(1/$c))", "$a+^($b^$c)", "$a+^(1/($b+$c))", "$a+^(1/($b-$c))", "$a+^(1/($a*$c))", "$a+^(1/($b/$c))", "$a+^(1/($b^(1/$c)))", "$a+^(1/($a^$c))"); if(!$_POST['A']) { ?> <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post"> Target:<input name="Target" type="text" size="20" maxlength="4"> Number 1:<input name="A" type="text" size="20" maxlength="2"> Number 2:<input name="B" type="text" size="20" maxlength="2"> Number 3:<input name="C" type="text" size="20" maxlength="2"> <input type="submit" name="Send" value="submit"> </form> <?php } else { $target = $_POST['Target']; $a = $_POST['A']; $b = $_POST['B']; $c = $_POST['C']; $nums = array(brute($a, $b, $c)); array_push ($num, brute($a, $c, $b)); array_push ($num, brute($b, $a, $c)); array_push ($num, brute($b, $c, $a)); array_push ($num, brute($c, $a, $b)); array_push ($num, brute($c, $b, $a)); $results = compare($nums, $target); while (list($pos, $result) = each($results)) { echo($result['result']); echo($result['function']); } } function brute($a, $b, $c) { $array = array(); while(list($pos, $function) = each($functions)) { $array2 = array ( "result"=>sprintf($function), "function"=>$function ); array_push($array, $array2); } return($array); } function compare($arrays, $target) { while(list($pos, $array)= each($arrays)) { $diffs = array(); array_push($diffs, $target - $array['result']); } $mins = min(diffs); while (list($pos, $min) = each( $mins)) { $results = array(); while (list($pos, $diff)= each($diffs)) { if ($min = $diff['result']) { array_push($results, $diff); } } } return ($results); }
×
×
  • 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.