Jump to content

Lamez

Members
  • Posts

    1,686
  • Joined

  • Last visited

    Never

Everything posted by Lamez

  1. This code I have been working on for weeks have givin me so much trouble. What is is suppose to do is pull the userpicks, the winners, the point values, and the users current points all from the DB. Well it does that just fine, then is checks to see if the winners match the userpicks, and if they do add points to there current point value for that round, and add it to the DB. Well it is not updating the users row in the DB under userpoints I set the default values in the userpoints to all to 0 the structure is: Username | total | rnd1 | rnd2 | rnd3 | rnd4 | rnd5 | champ ---------------------------------------------------------- Lamez | 0 | 0 | 0 | 0 | 0 | 0 | 0 That is the default when a user registers, but the code does not add points to the DB, why? The code is very consistent so once you have seen one IF statment, you have seen 'em all. Code: <?php include("style/include/session.php"); include ("style/include/cons/head.php"); echo '<div class="box">'; $user = "Lamez"; /*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']; /*$result=mysql_query('SELECT * FROM users'); while($row=mysql_fetch_array($result)){ $user=$row['user'];*/ if ( $win['1'] == $pick['a1'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['2'] == $pick['a2'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['3'] == $pick['a3'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['4'] == $pick['a4'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['5'] == $pick['a5'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['6'] == $pick['a6'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['7'] == $pick['a7'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['8'] == $pick['a8'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['9'] == $pick['b1'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['10'] == $pick['b2'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['11'] == $pick['b3'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['12'] == $pick['b4'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['13'] == $pick['b5'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['14'] == $pick['b6'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['15'] == $pick['b7'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['16'] == $pick['b8'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['17'] == $pick['c1'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['18'] == $pick['c2'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['19'] == $pick['c3'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['20'] == $pick['c4'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['21'] == $pick['c5'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['22'] == $pick['c6'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['23'] == $pick['c7'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['24'] == $pick['c8'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['25'] == $pick['d1'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['26'] == $pick['d2'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['27'] == $pick['d3'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['28'] == $pick['d4'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['29'] == $pick['d5'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['30'] == $pick['d6'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['31'] == $pick['d7'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } if ( $win['32'] == $pick['d8'] ) { $total = $value + $total; $rnd1 = $value + $rnd1; mysql_query("UPDATE `userpoints` SET `total`='$total', `1`='$rnd1' WHERE `username`='$user'"); } //} //End Loop print '</div>'; include ("style/include/cons/foot.php"); ?>
  2. man I am retarded, that is is oblivious. Thank you Scott!
  3. maybe this will help: <?php $Month = 2592000 + time(); //this adds 30 days to the current time setcookie(AboutVisit, date("F jS - g:i a"), $Month); ?> I found it here: http://php.about.com/od/advancedphp/qt/php_cookie.htm You could also take a look at one of these: http://www.google.com/search?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q=how+to+set+a+cookie+in+PHP
  4. how would I define $user? My code has $user in it to define where to pull info from the DB, and where to update it.
  5. Lamez

    Adobe CS3

    Well back in the day it started out from some company, and they named the program Jungle Beat. Then Macromedia bought them out, and name it dreamweaver, then Adobe bought out Macromedia, and replaced Adobe Livewire or something like what with Dreamweaver. I love Dreamweaver, I have the older version (Dreamweaver it was before adobe bought Macromedia.
  6. I want to make a loop to run my script for all my users in the DB, but how? I have never made a loop, ever. Also when it pulls out the user will it be able to define it as $user?
  7. I like dreamweaver, even though it is not free I love it. The way it changes the text to color coded makes it easier to read.
  8. are you getting any errors?
  9. well noted. I think I have it down now, I am not sure, but how do I do a loop? I know I would have to pull the user names from user table, I would have to make the loop run for ever user in the user table, but how?
  10. am I doing the IF statement right?
  11. I have been looking for something like this, try googling HTML Email with PHP
  12. bump for the night
  13. also, I need this to work after I have selected the winners, and update ever user in the system point values. Do I need loop? If so how?
  14. Oh ya that would be a good idea in the first IF statment, if the winner does not equal userpick, it does not add the points for the next if statment. <?php include("style/include/session.php"); include ("style/include/cons/head.php"); echo '<div class="box">'; if($session->logged_in){ $user = $session->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`"); $pick=mysql_fetch_array($q); /*Pull Point Values for Round 1*/ $q = mysql_query("Select * from `points`"); $point=mysql_fetch_array($q); $value = $point['0']; /*Pull User Points for Round 1*/ $q = mysql_query("Select * from `userpoints`"); $usrpoint=mysql_fetch_array($q); $total = $usrpoint['total']; $rnd1 = $usrpoint['1']; if ($win['0'] === ($pick['a1'])){ $total = $value + $total; $rnd1 = $value + $rnd1; $q = "UPDATE `userpoints` SET `total`=$total WHERE `username`='$user'"; mysql_query($q); $q = "UPDATE `userpoints` SET `1`=$rnd1 WHERE `username`='$user'"; mysql_query($q); }else{ if ($win['1'] === ($pick['a2'])){ $total = $value + $total; $rnd1 = $value + $rnd1; $q = "UPDATE `userpoints` SET `total`=$total WHERE `username`='$user'"; mysql_query($q); $q = "UPDATE `userpoints` SET `2`=$rnd1 WHERE `username`='$user'"; mysql_query($q); } echo "<h2>Point Test</h2>"; echo "<p>Your Total: $total<br>"; echo "Your Round 1: $rnd1</p>"; } }else{ include ("style/include/cons/member.php"); } print '</div>'; include ("style/include/cons/foot.php"); ?>
  15. I am trying to make a point system, but every attempt fails miserably, could someone help me? I pull the points for the user from the DB, then I pull the point values from the DB as well. Then I pull the winners, and the user picks from the database as well. Now I take the information and create a IF statement I say if $userpick === $winnner{ $total = $value + $rnd1; }else{ do not add and continue to the next pick. There are 32 chances to earn points, but it does not work at all. Also I have multiple users on the website, so would I have to do a loop? I want this to run after the admin makes the selection for the winners. Could just someone give me an example code? -Thanks
  16. I just tried that, and it did not work.. :-\
  17. Lamez

    need help

    lol oh np
  18. Lamez

    need help

    try this <?php $getlink = $_GET["link"]; if ($getlink == "page1") { echo "Hello This Is Page 1"; } elseif ($getlink == "page2") { echo "Welcome To Page 2"; } else { echo "Ooops! Page Not Found"; } ?> so its like ?link=page1 and the out put is "hello this is page 1"
  19. I hate using the update function, what am I doing wrong here? $q = "UPDATE `points` SET 1=$a, SET 2=$b, SET 3=$c, SET 4=$d, SET 5=$e, SET 6=$f WHERE id=$id"; mysql_query($q)or die(mysql_error()); I get this error:
  20. I am making a point system, for my bracket website. I want be able to select the winner, I have that, It adds it to a table in the db. But after I select the winners I want it to run the points php file for ever user. Will I have to do a loop? Also, will you guys look over my code, it is not running properly. It is suppose to check if TeamA is equal to TeamPicked, if so add points, then add the value to the DB, if not go on to the next If statement. It does add points if the values are the same, but it they are not, then it does not add the points for the if statement after that. It also does not update to the DB. <?php include("style/include/session.php"); include ("style/include/cons/head.php"); echo '<div class="box">'; if($session->logged_in){ $user = $session->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`"); $pick=mysql_fetch_array($q); /*Pull Point Values for Round 1*/ $q = mysql_query("Select * from `points`"); $point=mysql_fetch_array($q); $value = $point['0']; /*Pull User Points for Round 1*/ $q = mysql_query("Select * from `userpoints`"); $usrpoint=mysql_fetch_array($q); $total = $usrpoint['total']; $rnd1 = $usrpoint['1']; if ($win['0'] === ($pick['a1'])){ $total = $value + $total; $rnd1 = $value + $rnd1; $q = "UPDATE `userpoints` SET `total`=$total WHERE `username`='$user'"; mysql_query($q); $q = "UPDATE `userpoints` SET `1`=$rnd1 WHERE `username`='$user'"; mysql_query($q); }else{ if ($win['1'] === ($pick['a2'])){ $total = $value + $total; $rnd1 = $value + $rnd1; $q = "UPDATE `userpoints` SET `total`=$total WHERE `username`='$user'"; mysql_query($q); $q = "UPDATE `userpoints` SET `2`=$rnd1 WHERE `username`='$user'"; mysql_query($q); } echo "<h2>Point Test</h2>"; echo "<p>Your Total: $total<br>"; echo "Your Round 1: $rnd1</p>"; } }else{ include ("style/include/cons/member.php"); } print '</div>'; include ("style/include/cons/foot.php"); ?>
  21. What is your error? Also you set your formaction to form.php, make sure that is the name of the php file.
  22. how do I do more than one value in a Update Query?
  23. usually you can find this information in the footer, next time look in the footer.
  24. this is my mysql error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `1`='', '546', '985'' at line 1
  25. no that is not the problem, it is the mysql query, that part works great.
×
×
  • 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.