-
Posts
1,686 -
Joined
-
Last visited
Never
Everything posted by Lamez
-
so could I do this: <?php $value = "cat"; if ($value !== ("dog")){ echo "animal is a cat"; }else{ echo "animal is a dog"; } ?> The output of the code above it "animal is a cat" (w/o " of course)
-
Thank you very much for clarifying that for me. I have decided to go a different route on the script. This way I have planed it out should work.
-
wow I did not know that, would it be incorrect to use "==="
-
oh wait they are like this: check1 (table) r1-r32 userpoints (table) total, rnd1, rnd2, rnd3, rnd4, rnd5, rnd6
-
check1 (table) r1-r32 userpoints (table) rnd1, rnd2, rnd3, rnd4, rnd5, champ
-
nothing has returned, but still nothing in the check1 table
-
what did you change? It looks the same as my code post before
-
Alright I have a question, when I put to update querys together, only the points update, but if I move the other query, it only updates. Why? Here is the code: This one adds a 1 to the r1 field, but does not update points. if ($a1 != ("emp")){ if ($ck['r1'] = ("0")){ if ($a1 = ($pick['a1'])){ $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'")or die(mysql_error()); } } mysql_query("UPDATE `check1` SET `r1`='1' WHERE `id`='1'"); } This one updates the userpoints, but does not update a 1 into the r1 field if ($a1 != ("emp")){ if ($ck['r1'] = ("0")){ if ($a1 = ($pick['a1'])){ $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'")or die(mysql_error()); mysql_query("UPDATE `check1` SET `r1`='1' WHERE `id`='1'"); } } } How do I get them it to update both tables?
-
I think I fixed it, I just changed the position of the ! would this work? <?php if ($a1 != ("emp")){ if ($win['1'] = ($pick['a1'])){ $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'")or die(mysql_error()); } } ?>
-
Sorry to bother you guys once more, but my script is not working at all, it is suppose to check to see if the user picked the winner, if so add the points, from the points table. Well I tested it, I made the user pick the winner, and it does not add the points at all. Here is a code snippet, could someone read over it and tell me if I have any syntax errors. <?php $result=mysql_query('SELECT * FROM userpoints'); while($row = mysql_fetch_array($result)){ $user = $row['username']; /*Pull Winners for Round 1*/ $q = mysql_query("Select * from `rnd1_win`"); $win=mysql_fetch_array($q); /*Pull User Picks for Round 1*/ $q = mysql_query("Select * from `rnd1` where `username` = '$user'"); $pick=mysql_fetch_array($q); /*Pull Point Values for Round 1*/ $q = mysql_query("Select rnd1 from `points`"); $point=mysql_fetch_array($q); $value = $point['rnd1']; /*Pull User Points for Round 1*/ $q = mysql_query("Select `username`, `total`, `rnd1` from `userpoints` Where `username` = '$user'"); $usrpoint=mysql_fetch_array($q); $total = $usrpoint['total']; $rnd1 = $usrpoint['rnd1']; if (!$a1 == ("emp")){ if ($win['1'] = ($pick['a1'])){ $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'")or die(mysql_error()); } } } ?> Breaking Down the If Statement if (!$a1 == ("emp")){ check to see if the postdata is equal to emp, and if not continue the script, if so skip this portion and continue to next if. if ($win['1'] = ($pick['a1'])){ check to see if the user picked the winner, if so continue to add points $total = $value + $total; take value from point table, and add it to the total, then get a new total $rnd1 = $value + $rnd1; take the value from the point table, and add it to round one (rnd1) then get new rnd1 mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'")or die(mysql_error()); update the DB } } Close if statements -Thanks Guys!
-
maybe posting this will help: <?php $winner = $win['1']; $check = $ck['r1']; $a = $a1; $b = $a16; $var = "a1"; if ($check === ("0")){ echo "<select name=".$var.">"; echo '<option value="emp"></option>'; echo '<option value="'.$a.'">'.$a.'</option>'; echo '<option value="'.$b.'">'.$b.'</option>'; echo '</select>'; }else{ echo $winner; echo '<input name="'.$var.'" type="hidden" id="'.$var.'" value="'.$winner.'" />'; } ?> any errors there?
-
would the triple equal signs have any effect? should I change them to just 2 equal signs?
-
can't you do something like this: <?php $name = $_POST['name']; if (empty($name)){ //do somthing, the field is empty }else{ //the field is not empty, do somthing } ?>
-
ya I forget to do stupid stuff like that all the time. lol
-
I am anything but a guru, but a permission does not deal with php, it is server side, depending on the permission will depend upon what the user\script will be able to do with that file, like write in it, and save it. you can read more here: http://www.pair.com/support/knowledge_base/the_basics/file_permissions.html
-
I am not too sure on what you are asking, the value is set here, on these lines: <?php /*Pull Winners for Round 1*/ $q = mysql_query("Select * from `rnd1_win`"); $win=mysql_fetch_array($q); /*Pull User Picks for Round 1*/ $q = mysql_query("Select * from `rnd1` Where `username` = '$user'"); $pick=mysql_fetch_array($q); /*Pull Point Values for Round 1*/ $q = mysql_query("Select rnd1 from `points`"); $point=mysql_fetch_array($q); $value = $point['rnd1']; /*Pull User Points for Round 1*/ $q = mysql_query("Select `username`, `total`, `rnd1` from `userpoints` Where `username` = '$user'"); $usrpoint=mysql_fetch_array($q); $total = $usrpoint['total']; $rnd1 = $usrpoint['rnd1']; ?>
-
well let me break down this code for you: if ($ck['r1'] === ("0")){ this line here checks to see if there is a 0 instead of a one if so continue if (!$win['a1'] === ("emp")){ this line checks to see if the admin made a selection on this field, if he has, the selection will not be emp, it will be somthing else if ($win['1'] === ($pick['a1'])){ this line here check to see if the user picked the winner, if so it will add points which are on the next 2 lines $total = $value + $total; this line here will take their current total, and add the point value, the admin has setup, and will give them a new total $rnd1 = $value + $rnd1; this line here takes the their current total in rnd1 and will add the point value the admin has setup, and give them a new value mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'")or die(mysql_error()); this line updates the db, with rnd1 and total where there username is mysql_query("UPDATE `rnd1_check` SET `r1`='1' WHERE `id`='1'")or die (mysql_error()); this line gives me trouble, it adds a one to the database so this round, so the round could not be ran again. } } closes the if statments }
-
all the code works fine, it just does not add a 1 to the db, and I have no idea why. is there something wrong with my if statements? my query's? I do not understand why it is not adding a 1 to r1 under rnd1_check
-
I am not too sure if that code is going to work, and here is why: This is on the admin side, the admin will choose the round winners, then the script will change the post variables into easy to remember to variables ($a1 = $_POST['1a'], then it will update the round winners into rnd1_win, then it runs a included file called pnts_1.php, this file has a loop, it checks ever user to see if they have chosen the winner, but on the admin side, the admin can make changes to the winners in that round, because there are more than one game in the round, so he needs to be able to update it, so the script side it checks the table for a 1 to see if that team win has been processed, if not then it process it, then adds a one to the db. well here is the first page of the script: <?php include ("../../../style/include/session.php"); include ("../../../style/include/cons/head_3.php"); if($session->isAdmin()){ $a1 = $_POST['a1']; $a2 = $_POST['a8']; $a3 = $_POST['a5']; $a4 = $_POST['a4']; $a5 = $_POST['a6']; $a6 = $_POST['a3']; $a7 = $_POST['a7']; $a8 = $_POST['a2']; $b9 = $_POST['b1']; $b10 = $_POST['b8']; $b11 = $_POST['b5']; $b12 = $_POST['b4']; $b13 = $_POST['b6']; $b14 = $_POST['b3']; $b15 = $_POST['b7']; $b16 = $_POST['b2']; $c17 = $_POST['c1']; $c18 = $_POST['c8']; $c19 = $_POST['c5']; $c20 = $_POST['c4']; $c21 = $_POST['c6']; $c22 = $_POST['c3']; $c23 = $_POST['c7']; $c24 = $_POST['c2']; $d25 = $_POST['d1']; $d26 = $_POST['d8']; $d27 = $_POST['d5']; $d28 = $_POST['d4']; $d29 = $_POST['d6']; $d30 = $_POST['d3']; $d31 = $_POST['d7']; $d32 = $_POST['d2']; $q = "UPDATE `rnd1_win` SET `1` = '$a1', `2` = '$a2', `3` = '$a3', `4` = '$a4', `5` = '$a5', `6` = '$a6', `7` = '$a7', `8` = '$a8', `9` = '$b9', `10` = '$b10', `11` = '$b11', `12` = '$b12', `13` = '$b13', `14` = '$b14', `15` = '$b15', `16` = '$b16', `17` = '$c17', `18` = '$c18', `19` = '$c19', `20` = '$c20', `21` = '$c21', `22` = '$c22', `23` = '$c23', `24` = '$c24', `25` = '$d25', `26` = '$d26', `27` = '$d27', `28` = '$d28', `29` = '$d29', `30` = '$d30', `31` = '$d31', `32` = '$d32' WHERE `id` = '1'"; mysql_query($q) or die(mysql_error()); include ("pnt_1.php"); print '<div class="box"><h2>Winners Updated</h2>'; print '<p>Winners Updated for Round 2<br><br>'; print '<a href="slcwin_1.php">Round 2</a></p>'; print '</div>'; }else{ header("Location: ../../../index.php"); } include ("../../../style/include/cons/foot.php"); ?> here is pnt_1.php <?php include ("../../../style/include/session.php"); $result=mysql_query('SELECT * FROM userpoints'); while($row = mysql_fetch_array($result)){ $user = $row['username']; /*Pull Winners for Round 1*/ $q = mysql_query("Select * from `rnd1_win`"); $win=mysql_fetch_array($q); /*Pull User Picks for Round 1*/ $q = mysql_query("Select * from `rnd1` Where `username` = '$user'"); $pick=mysql_fetch_array($q); /*Pull Point Values for Round 1*/ $q = mysql_query("Select rnd1 from `points`"); $point=mysql_fetch_array($q); $value = $point['rnd1']; /*Pull User Points for Round 1*/ $q = mysql_query("Select `username`, `total`, `rnd1` from `userpoints` Where `username` = '$user'"); $usrpoint=mysql_fetch_array($q); $total = $usrpoint['total']; $rnd1 = $usrpoint['rnd1']; /*Pull Info from check table*/ $q = mysql_query("SELECT * FROM `rnd1_check`")or die(mysql_query()); $ck = mysql_fetch_array($q)or die(mysql_query()); if ($ck['r1'] === ("0")){ if (!$pick['a1'] === ("emp")){ if ($win['1'] === ($pick['a1'])){ $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'")or die(mysql_error()); mysql_query("UPDATE `rnd1_check` SET `r1`='1' WHERE `id`='1'")or die (mysql_error()); } } } } ?>
-
try permissions.
-
Alright I have this code, it is suppose to check to see if the pick is not equal to emp, if not then it checks to see if there is a zero in the respective field in the database, if so then it checks to see if the user picked the winner, and if so it add points, then it adds a 1 to the database, so no user can get points for that round again once the script is run again, but it is not adding a one, could someone look over the code for any errors: <?php $result=mysql_query('SELECT * FROM userpoints'); while($row=mysql_fetch_array($result)){ $user=$row['username']; /*Pull Winners for Round 1*/ $q = mysql_query("Select * from `rnd1_win`"); $win=mysql_fetch_array($q); /*Pull User Picks for Round 1*/ $q = mysql_query("Select * from `rnd1` Where `username` = '$user'"); $pick=mysql_fetch_array($q); /*Pull Point Values for Round 1*/ $q = mysql_query("Select rnd1 from `points`"); $point=mysql_fetch_array($q); $value = $point['rnd1']; /*Pull User Points for Round 1*/ $q = mysql_query("Select `username`, `total`, `rnd1` from `userpoints` Where `username` = '$user'"); $usrpoint=mysql_fetch_array($q); $total = $usrpoint['total']; $rnd1 = $usrpoint['rnd1']; /*Pull Info from check table*/ $qu = "SELECT * FROM `rnd1_check`"; $re = mysql_query($qu); $ck = mysql_fetch_array($re); if (!$pick['a1'] === ("emp")){ if ($ck['r1'] === ("0")){ if ($win['1'] === ($pick['a1'])){ $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'")or die(mysql_error()); mysql_query("UPDATE `rnd1_check` SET `r1`='1' WHERE `id`='1'")or die (mysql_error()); } } } } ?>
-
you can do it, you will need a database, I would think at least.
-
it updates the winner, but does not put a 1 in the check table (r1, r2, etc) that page I posted was included from this page, maybe this page is the problem: <?php include ("../../../style/include/session.php"); include ("../../../style/include/cons/head_3.php"); if($session->isAdmin()){ $a1 = $_POST['a1']; $a2 = $_POST['a8']; $a3 = $_POST['a5']; $a4 = $_POST['a4']; $a5 = $_POST['a6']; $a6 = $_POST['a3']; $a7 = $_POST['a7']; $a8 = $_POST['a2']; $b9 = $_POST['b1']; $b10 = $_POST['b8']; $b11 = $_POST['b5']; $b12 = $_POST['b4']; $b13 = $_POST['b6']; $b14 = $_POST['b3']; $b15 = $_POST['b7']; $b16 = $_POST['b2']; $c17 = $_POST['c1']; $c18 = $_POST['c8']; $c19 = $_POST['c5']; $c20 = $_POST['c4']; $c21 = $_POST['c6']; $c22 = $_POST['c3']; $c23 = $_POST['c7']; $c24 = $_POST['c2']; $d25 = $_POST['d1']; $d26 = $_POST['d8']; $d27 = $_POST['d5']; $d28 = $_POST['d4']; $d29 = $_POST['d6']; $d30 = $_POST['d3']; $d31 = $_POST['d7']; $d32 = $_POST['d2']; $q = "UPDATE `rnd1_win` SET `1` = '$a1', `2` = '$a2', `3` = '$a3', `4` = '$a4', `5` = '$a5', `6` = '$a6', `7` = '$a7', `8` = '$a8', `9` = '$b9', `10` = '$b10', `11` = '$b11', `12` = '$b12', `13` = '$b13', `14` = '$b14', `15` = '$b15', `16` = '$b16', `17` = '$c17', `18` = '$c18', `19` = '$c19', `20` = '$c20', `21` = '$c21', `22` = '$c22', `23` = '$c23', `24` = '$c24', `25` = '$d25', `26` = '$d26', `27` = '$d27', `28` = '$d28', `29` = '$d29', `30` = '$d30', `31` = '$d31', `32` = '$d32' WHERE `id` = '1'"; mysql_query($q) or die(mysql_error()); include ("pnt_1.php"); print '<div class="box"><h2>Winners Updated</h2>'; print '<p>Winners Updated for Round 2<br><br>'; print '<a href="slcwin_1.php">Round 2</a></p>'; print '</div>'; }else{ header("Location: ../../../index.php"); } include ("../../../style/include/cons/foot.php"); ?>
-
This is code is not processing properly What it is suppose to do is: 1.check to see if the row r1 is equal to 0 if so, then it will check to see if the user made the correct pick with the winner, if so add points, then to does the same with the next selections. 2.Then it checks to see if the processed variables where equal to emp or not, if so replaces the one with a 0 in the DB, to tell it, it can be processed again. Well it does not anything in the DB at all, nothing is updating. here is the code: <?php include ("../../../style/include/session.php"); function updateTb($tb, $row){ $q = "UPDATE `$tb` SET `$row` = '1'"; mysql_query($q); } function checkVar($var, $num){ if ($var === ("emp")){ $q = "UPDATE `rnd1_check` SET `r".$num."` = '0' WHERE `id` = '1'"; mysql_query($q); } } $table = "rnd1_check"; $qu = "SELECT * FROM `$table`"; $re = mysql_query($qu); $ck = mysql_fetch_array($re); $result=mysql_query('SELECT * FROM userpoints') or die(mysql_error()); while($row=mysql_fetch_array($result)){ $user=$row['username']; /*Pull Winners for Round 1*/ $q = mysql_query("Select * from `rnd1_win`"); $win=mysql_fetch_array($q); /*Pull User Picks for Round 1*/ $q = mysql_query("Select * from `rnd1` Where `username` = '$user'"); $pick=mysql_fetch_array($q); /*Pull Point Values for Round 1*/ $q = mysql_query("Select rnd1 from `points`"); $point=mysql_fetch_array($q); $value = $point['rnd1']; /*Pull User Points for Round 1*/ $q = mysql_query("Select `username`, `total`, `rnd1` from `userpoints` Where `username` = '$user'"); $usrpoint=mysql_fetch_array($q); $total = $usrpoint['total']; $rnd1 = $usrpoint['rnd1']; if ($ck['r1'] == ("0")){ if ( $win['1'] == $pick['a1'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r1); } } if ($ck['r2'] == ("0")){ if ( $win['2'] == $pick['a2'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r2); } } if ($ck['r3'] == ("0")){ if ( $win['3'] == $pick['a3'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r3); } } if ($ck['r4'] == ("0")){ if ( $win['4'] == $pick['a4'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r4); } } if ($ck['r5'] == ("0")){ if ( $win['5'] == $pick['a5'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r5); } } if ($ck['r6'] == ("0")){ if ( $win['6'] == $pick['a6'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r6); } } if ($ck['r7'] == ("0")){ if ( $win['7'] == $pick['a7'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r7); } } if ($ck['r8'] == ("0")){ if ( $win['8'] == $pick['a8'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r8); } } if ($ck['r9'] == ("0")){ if ( $win['9'] == $pick['b1'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r9); } } if ($ck['r10'] == ("0")){ if ( $win['10'] == $pick['b2'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r10); } } if ($ck['r11'] == ("0")){ if ( $win['11'] == $pick['b3'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r11); } } if ($ck['r12'] == ("0")){ if ( $win['12'] == $pick['b4'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r12); } } if ($ck['r13'] == ("0")){ if ( $win['13'] == $pick['b5'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r13); } } if ($ck['r14'] == ("0")){ if ( $win['14'] == $pick['b6'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r14); } } if ($ck['r15'] == ("0")){ if ( $win['15'] == $pick['b7'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r15); } } if ($ck['r16'] == ("0")){ if ( $win['16'] == $pick['b8'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r16); } } if ($ck['r17'] == ("0")){ if ( $win['17'] == $pick['c1'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r17); } } if ($ck['r18'] == ("0")){ if ( $win['18'] == $pick['c2'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r18); } } if ($ck['r19'] == ("0")){ if ( $win['19'] == $pick['c3'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r19); } } if ($ck['r20'] == ("0")){ if ( $win['20'] == $pick['c4'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r20); } } if ($ck['r21'] == ("0")){ if ( $win['21'] == $pick['c5'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r21); } } if ($ck['r22'] == ("0")){ if ( $win['22'] == $pick['c6'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r22); } } if ($ck['r23'] == ("0")){ if ( $win['23'] == $pick['c7'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r23); } } if ($ck['r24'] == ("0")){ if ( $win['24'] == $pick['c8'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r24); } } if ($ck['r25'] == ("0")){ if ( $win['25'] == $pick['d1'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r25); } } if ($ck['r26'] == ("0")){ if ( $win['26'] == $pick['d2'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r26); } } if ($ck['r27'] == ("0")){ if ( $win['27'] == $pick['d3'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r27); } } if ($ck['r28'] == ("0")){ if ( $win['28'] == $pick['d4'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r2); } } if ($ck['r29'] == ("0")){ if ( $win['29'] == $pick['d5'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r29); } } if ($ck['r30'] == ("0")){ if ( $win['30'] == $pick['d6'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r30); } } if ($ck['r31'] == ("0")){ if ( $win['31'] == $pick['d7'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r31); } } if ($ck['r32'] == ("0")){ if ( $win['32'] == $pick['d8'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `rnd1`='$rnd1' WHERE `username`='$user'"); updateTb($table, r32); } } checkVar($a1, 1); checkVar($a2, 2); checkVar($a3, 3); checkVar($a4, 4); checkVar($a5, 5); checkVar($a6, 6); checkVar($a7, 7); checkVar($a8, ; checkVar($b1, 9); checkVar($b2, 10); checkVar($b3, 11); checkVar($b4, 12); checkVar($b5, 13); checkVar($b6, 14); checkVar($b7, 15); checkVar($b8, 16); checkVar($c1, 17); checkVar($c2, 18); checkVar($c3, 19); checkVar($c4, 20); checkVar($c5, 21); checkVar($c6, 22); checkVar($c7, 23); checkVar($c8, 24); checkVar($d1, 25); checkVar($d2, 26); checkVar($d3, 27); checkVar($d4, 28); checkVar($d5, 29); checkVar($d6, 30); checkVar($d7, 31); checkVar($d8, 32); } ?>
-
alright I have edited my code, and I got it to work. Then I used it again on the same page, and both places where I used the function where blank, when the values where the same, here is the new code: <?php function checkTable($num, $a, $b){ $rnd = "rnd1_win"; $query = "SELECT * FROM `$rnd`"; $result = mysql_query($query); $win = mysql_fetch_array($result); $table = "rnd1_check"; $qu = "SELECT * FROM `$table`"; $re = mysql_query($qu); $ck = mysql_fetch_array($re); if ($ck['r'.$num.''] === ("0")){ echo "<select>"; echo '<option value="emp"></option>'; echo '<option value="'.$a.'">'.$a.'</option>'; echo '<option value="'.$b.'">'.$b.'</option>'; echo '</select>'; }else{ echo $win['$num']; } } ?>