SteveTs Posted August 30, 2008 Share Posted August 30, 2008 Hey guys, I'm in a bit of a jam here. I've been running a football pick'em for the last couple of years on a site and am trying to move it to a new site for this upcoming season (which starts Thursday). The page is up at http://www.tmrzoo.com/sports/football-predictions.php . Everything seems to be working fine with one exception... the readers' picks will not write to the db. It should enter the picks in the db, then show the percentages of the picks from all readers for that week for all readers who have submitted picks already. The new site is PHP 4.4.6 & MySQL 5, the old was PHP 4.3.0 and I believe MySQL was the same, but it could have been 4. I apologize if posting all that code is bad manners. I really don't know much about this stuff, I was just a sports editor on the last site and want to run the same feature. Here is the page: <?php chdir("../forum/"); require('global.php'); chdir("../sports/"); require_once('mainfile.php'); $currentweek = "1"; $currentyear = "2008"; ?> <html> <head> <title>NFL Football Weekly Predictions: Week <?php echo"$currentweek"; ?> NFL National Football League Pick Em Pool</title> <meta name="ROBOTS" content="ALL, FOLLOW, INDEX"> <meta name="KEYWORDS" content="Pro Sports, Fantasy Sports, NFL Weekly Predictions, NFL National Football League"> <meta name="DESCRIPTION" content="Pro Sports, Fantasy Sports, NFL Weekly Predictions, NFL National Football League"> <meta name="PRODUCT" content=""> <meta name="CATEGORY" content=""> <meta name="CULTURE" content="en-US"> <meta name="LANGUAGE" content="en"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <?php include ("http://www.tmrzoo.com/includes/header-sports.php"); ?> <?php echo "<table width=\"645\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" height=100%> <tr> <td width=645 valign=top> <img src=\"/images/nfl/transpdot.gif\" width=645 height=1><br> <table border=0 cellpadding=9 cellspacing=0 width=100%> <tr><td width=100% valign=top> <table border=0 cellpadding=0 cellspacing=0 width=100%> <tr> <td valign=top> <font class=headlinetitle><b>Week $currentweek NFL House Predictions</b></font><br> <img src=\"/images/nfl/transpdot.gif\" width=1 height=5><br><font class=headlinetext>"; global $user, $cookie, $prefix, $dbi; if ($opi != "ds") { if ($vbulletin->userinfo['userid']!=0) { $username2 = $vbulletin->userinfo['username']; } $result =@mysql_query("SELECT username FROM sports_football_predict_votes WHERE username = '$username2' AND week = '$currentweek' AND year = '$currentyear' ", $dbi); //testing on /off $myrow = mysql_fetch_array($result); // $myrow = mysql_fetch_array($result, MYSQL_BOTH); eliminated MYSQL_BOTH $usernamet = $myrow["username"]; if ($usernamet == "") { $username = $username2; if ($vbulletin->userinfo['userid']!=0) { echo " $username, Think you're a pick-em god? Show what you've got by agreeing or disagreeing with each of Steve's psychic selections every week. If he scores more wins, the forum bragging will be endless. If you, the members, as a collective can topple him we'll deposit a TMR shirt on one of your doorsteps. Running results will appear after your choices are submitted. Good luck!</td>"; } else { echo"<b><font color=\"#CC0000\">You are not logged in</b></font> <p> You must be a member to participate in Beat the House. Registration is free and takes seconds to complete. <p><center><a href=\"http://www.tmrzoo.com/forum/register.php?\">register at The TMRzoo</a> | <a href=\"http://www.tmrzoo.com/forum\">Login</a></center></td>"; } echo "<td width=15><img src=\"/images/nfl/transpdot.gif\" width=15 height=165></td> <td valign=top align=right width=318> <table border=0 cellpadding=0 cellspacing=0 width=100%> <tr> <td background=\"/images/pickembkg.jpg\" width=318 height=134 valign=top> <table border=0 cellpadding=0 cellspacing=0 width=305> <tr> <td valign=top><img src=\/images/nfl/transpdot.gif\" width=155 height=1><br></td> <td valign=top width=250> <img src=\"/images/nfl/transpdot.gif\" width=1 height=9><br> <table border=0 cellpadding=0 cellspacing=0 width=100%> <tr> <td><font class=newsfooterheader>leaders</font></td> <td align=right><a class=pickem href=\"football-predictions-leaders.php\">view all</a></td> </tr> </table> <img src=\"/images/nfl/transpdot.gif\" width=1 height=8><br> <table border=0 cellpadding=2 cellspacing=0 width=100%>"; //3 $result4 =@mysql_query("SELECT * FROM sports_football_predict_member WHERE year = '$currentyear' ORDER BY tally DESC limit 5", $dbi); while($row = mysql_fetch_array($result4)) { echo "<tr><td valign=top><font class=headlinetext>$row[username]</font></td><td align=right><font class=headlinetext>$row[tally]</font></td></tr>"; } echo " </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <table border=0 cellpadding=0 cellspacing=0><FORM METHOD=\"post\" ACTION=\"football-predictions.php\">"; $result =@mysql_query("SELECT * FROM sports_football_predict WHERE week='$currentweek' and year='$currentyear' order by id", $dbi); while(list($id, $year, $week, $home, $away, $prediction) = mysql_fetch_row($result)) { echo"<tr><td valign=top><img src=\"/images/nfl/helmets/$away.jpg\" width=55 height=50 align=left></td> <td valign=top><img src=\"/images/nfl/helmets/$home.jpg\" width=55 height=50 align=left></td> <td> </td> <td valign=top bgcolor=\"#B3CDC0\"> <table border=0 cellpadding=0 cellspacing=0> <tr><td><img src=\"/images/nfl/bgbox-blueupperleft.gif\" width=9 height=9 border=0></td><td></td></tr> <tr><td></td><td valign=top> <table border=0 cellpadding=3 cellpadding=0><tr><td> <font class=headlinetext>$prediction<br> </td></tr></table></td></tr> <tr><td><img src=\"/images/nfl/bgbox-bluelowerleft.gif\" width=9 height=9 border=0></td><td></td></tr> </table> </td> <td valign=middle bgcolor=\"#435654\" width=100> <table border=0 cellpadding=3 cellspacing=0> <tr><td nowrap><input type=radio value=\"1\" name=\"a$id\"><font class=newsfooterheader> Agree</td></tr> <tr><td nowrap><input type=radio value=\"0\" name=\"a$id\"><font class=newsfooterheader> Disagree</td></tr> </table> </td> </tr><tr><td colspan=5> </td></tr>"; } if ($vbulletin->userinfo['userid']!=0) { echo "<tr><td colspan=2></td><td colspan=3><center> <INPUT type=\"hidden\" name=\"opi\" value=\"ds\"> <INPUT type=\"hidden\" name=\"username\" value=\"$username\"> $opi <center> <table border=0 cellpadding=0 cellspacing=0 width=162 height=28> <tr> <td width=162 height=28><center><input type=image src=\"/images/nfl/linkbg.gif\" width=162 height=28></td> </tr> </table></center></td></form></tr></table><p>"; } else { echo"<tr><td colspan=2></td><td colspan=2><center><font class=headlinetext><p><b><font color=\"#CC0000\">You are not logged in</b></font> <p> You must be a member to participate in Beat the House. Registration is free and takes seconds to complete. <p><center><a href=\"http://www.tmrzoo.com/forum/register.php?\">register at The Zoo</a> | <a href=\"http://www.tmrzoo.com/forum\">Login</a></center></td></tr></table>"; } } else { // ALREADY VOTED $profield = 0; echo "You've already submitted this week's picks. <p> The weekly member leaderboard and Steve's recap will appear the day after the final game of the week. <p> Check back here often to see how the member percentages shift versus Steve's picks.</td> <td width=15><img src=\"/images/nfl/transpdot.gif\" width=15 height=165></td> <td valign=top align=right width=318> <table border=0 cellpadding=0 cellspacing=0 width=100%> <tr> <td background=\"/images/pickembkg.jpg\" width=318 height=134 valign=top> <table border=0 cellpadding=0 cellspacing=0 width=305> <tr> <td valign=top><img src=\"/images/nfl/transpdot.gif\" width=155 height=1><br></td> <td valign=top width=250> <img src=\"/images/nfl/transpdot.gif\" width=1 height=9><br> <table border=0 cellpadding=0 cellspacing=0 width=100%> <tr> <td><font class=newsfooterheader>leaders</font></td> <td align=right><a class=pickem href=\"football-predictions-leaders.php\">view all</a></td> </tr> </table> <img src=\"/images/nfl/transpdot.gif\" width=1 height=8><br> <table border=0 cellpadding=2 cellspacing=0 width=100%>"; //5 $result4 =@mysql_query("SELECT * FROM sports_football_predict_member WHERE year = '$currentyear' ORDER BY tally DESC limit 5", $dbi); while($row = mysql_fetch_array($result4)) { echo "<tr><td valign=top><font class=headlinetext>$row[username]</font></td><td align=right><font class=headlinetext>$row[tally]</font></td></tr>"; } echo " </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <table border=0 cellpadding=0 cellspacing=0>"; //6 $result =@mysql_query("SELECT * FROM sports_football_predict WHERE week='$currentweek' AND year='$currentyear' order by id", $dbi); while($row = mysql_fetch_array($result)) { $profield = $profield + 1; $profield2 = "pro$profield"; // 7 $resultfor =@mysql_query("SELECT * FROM sports_football_predict_votes WHERE week = '$currentweek' AND '$profield2' = '1' AND year='$currentyear' AND username != 'Tomahoochi' '$querylang'", $dbi); $numresultsfor =mysql_num_rows($resultfor); //8 $resultagainst =@mysql_query("SELECT * FROM sports_football_predict_votes WHERE week = '$currentweek' AND '$profield2' = '0' AND year='$currentyear' AND username != 'Tomahoochi' '$querylang'", $dbi); $numresultsagainst =mysql_num_rows($resultagainst); $numresultstotal = 0; $numresultstotal = $numresultsfor + $numresultsagainst; $forscore = 0; $forscore = number_format((($numresultsfor / $numresultstotal) * 100), 1); $againstscore = 0; $againstscore = number_format(($numresultsagainst / $numresultstotal) * 100, 1); echo"<tr><td valign=top><img src=\"/images/nfl/helmets/$row[away].jpg\" width=55 height=50 align=left></td> <td valign=top><img src=\"/images/nfl/helmets/$row[home].jpg\" width=55 height=50 align=left></td> <td> </td> <td valign=top bgcolor=\"#B3CDC0\"> <table border=0 cellpadding=0 cellspacing=0> <tr><td><img src=\"/images/nfl/bgbox-blueupperleft.gif\" width=9 height=9 border=0></td><td></td></tr> <tr><td></td><td valign=top> <table border=0 cellpadding=3 cellpadding=0><tr><td> <font class=headlinetext>$row[prediction]<br> </td></tr></table></td></tr> <tr><td><img src=\"/images/nfl/bgbox-bluelowerleft.gif\" width=9 height=9 border=0></td><td></td></tr> </table> </td> <td valign=middle bgcolor=\"#435654\" width=100> <table border=0 cellpadding=4 cellspacing=0> <tr><td nowrap align=right><font class=newsfooterheader>for</font></td><td nowrap width=50> <img src=\"/images/nfl/bar.gif\" width=$forscore% height=12></td><td><td nowrap><font class=newsfooterheader><b>$forscore %</b></td></tr> <tr><td nowrap align=right><font class=newsfooterheader>against</font></td><td nowrap width=50> <img src=\"/images/nfl/bar.gif\" width=$againstscore% height=12></td><td><td nowrap><font class=newsfooterheader><b>$againstscore %</b></td></tr> </table> </td></tr> <tr><td colspan=5> </td></tr>"; } echo "</table>"; } } else if ($opi == "ds") { // $username2 = $username; //9 $result =@mysql_query("SELECT username FROM sports_football_predict_votes WHERE username = '$username2' AND week = '$currentweek' AND year='$currentyear' ", $dbi); $myrow = mysql_fetch_array($result); //$myrow = mysql_fetch_array($result, $dbi); //change $usernamet = $myrow["username"]; //10 if ($usernamet == "") {@mysql_query("INSERT INTO sports_football_predict_votes VALUES (NULL, '$currentyear', '$currentweek', '$username', '$a774', '$a775', '$a776', '$a777', '$a778', '$a779', '$a780', '$a781', '$a782', '$a783', '$a784', '$a785', '$a786', '$a787', '$a788', '$a789')", $dbi); } else { } $profield = 0; echo "Your choices are in and the running tallies are below. <p> The weekly member leaderboard and Steve's recap will appear the day after the final game of the week. <p> Check back here often to see how the member percentages shift versus Steve's picks.</td> <td width=15><img src=\"/images/nfl/transpdot.gif\" width=15 height=165></td> <td valign=top align=right width=318> <table border=0 cellpadding=0 cellspacing=0 width=100%> <tr> <td background=\"/images/pickembkg.jpg\" width=318 height=134 valign=top> <table border=0 cellpadding=0 cellspacing=0 width=305> <tr> <td valign=top><img src=\"/images/nfl/transpdot.gif\" width=155 height=1><br></td> <td valign=top width=250> <img src=\"/images/nfl/transpdot.gif\" width=1 height=9><br> <table border=0 cellpadding=0 cellspacing=0 width=100%> <tr> <td><font class=newsfooterheader>leaders</font></td> <td align=right><a class=pickem href=\"football-predictions-leaders.php\">view all</a></td> </tr> </table> <img src=\"/images/nfl/transpdot.gif\" width=1 height=8><br> <table border=0 cellpadding=2 cellspacing=0 width=100%>"; //11 $result4 =@mysql_query("SELECT * FROM sports_football_predict_member WHERE year = '$currentyear' ORDER BY tally DESC limit 5", $dbi); while($row = mysql_fetch_array($result4)) { echo "<tr><td valign=top><font class=headlinetext>$row[username]</font></td><td align=right><font class=headlinetext>$row[tally]</font></td></tr>"; } echo " </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <table border=0 cellpadding=0 cellspacing=0>"; //12 $result =@mysql_query("SELECT * FROM sports_football_predict WHERE week='$currentweek' AND year='$currentyear' order by id", $dbi); while($row = mysql_fetch_array($result)) { $profield = $profield + 1; $profield2 = "pro$profield"; //13 $resultfor =@mysql_query("SELECT * FROM sports_football_predict_votes WHERE week = '$currentweek' AND '$profield2' = '1' AND year='$currentyear' AND username != 'Tomahoochi' '$querylang'", $dbi); $numresultsfor =mysql_num_rows($resultfor); //14 $resultagainst =@mysql_query("SELECT * FROM sports_football_predict_votes WHERE week = '$currentweek' AND '$profield2' = '0' AND year='$currentyear' AND username != 'Tomahoochi' '$querylang'", $dbi); $numresultsagainst =mysql_num_rows($resultagainst); // $numresultsagainst =mysql_num_rows($resultagainst, $dbi); $numresultstotal = 0; $numresultstotal = $numresultsfor + $numresultsagainst; $forscore = 0; $forscore = number_format((($numresultsfor / $numresultstotal) * 100), 1); $againstscore = 0; $againstscore = number_format((($numresultsagainst / $numresultstotal) * 100), 1); echo"<tr><td valign=top><img src=\"/images/nfl/helmets/$row[away].jpg\" width=55 height=50 align=left></td> <td valign=top><img src=\"/images/nfl/helmets/$row[home].jpg\" width=55 height=50 align=left></td> <td> </td> <td valign=top bgcolor=\"#B3CDC0\"> <table border=0 cellpadding=0 cellspacing=0> <tr><td><img src=\"/images/nfl/bgbox-blueupperleft.gif\" width=9 height=9 border=0></td><td></td></tr> <tr><td></td><td valign=top> <table border=0 cellpadding=3 cellpadding=0><tr><td> <font class=headlinetext>$row[prediction]<br> </td></tr></table></td></tr> <tr><td><img src=\"/images/nfl/bgbox-bluelowerleft.gif\" width=9 height=9 border=0></td><td></td></tr> </table> </td> <td valign=middle bgcolor=\"#435654\" width=100> <table border=0 cellpadding=4 cellspacing=0> <tr><td nowrap align=right><font class=newsfooterheader>for</font></td><td nowrap width=50> <img src=\"/images/nfl/bar.gif\" width=$forscore% height=12></td><td><td nowrap><font class=newsfooterheader><b>$forscore %</b></td></tr> <tr><td nowrap align=right><font class=newsfooterheader>against</font></td><td nowrap width=50> <img src=\"/images/nfl/bar.gif\" width=$againstscore% height=12></td><td><td nowrap><font class=newsfooterheader><b>$againstscore %</b></td></tr> </table> </td></tr> <tr><td colspan=5> </td></tr>"; } echo "</table>"; } echo "</td></tr></table>"; // include ("includes/footer-sports.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/121970-help-with-football-picks-entry-page/ Share on other sites More sharing options...
ratcateme Posted August 30, 2008 Share Posted August 30, 2008 try removing all the '@'s from the start of your mysql query's and putting "or die(mysql_error());" on the end like this mysql_query("QUERY") or die die(mysql_error()); Scott. Quote Link to comment https://forums.phpfreaks.com/topic/121970-help-with-football-picks-entry-page/#findComment-629612 Share on other sites More sharing options...
SteveTs Posted August 30, 2008 Author Share Posted August 30, 2008 Thanks nothing changed after I did that. I'm thinking that when the submit button is clicked is not make $opi equal ds for some reason and not triggering the INSERT command Quote Link to comment https://forums.phpfreaks.com/topic/121970-help-with-football-picks-entry-page/#findComment-629672 Share on other sites More sharing options...
SteveTs Posted August 30, 2008 Author Share Posted August 30, 2008 If no one has any ideas or can't help (I realize I posted a ton of code) Is there an online pay service I can submit this to to be fixed? Quote Link to comment https://forums.phpfreaks.com/topic/121970-help-with-football-picks-entry-page/#findComment-629742 Share on other sites More sharing options...
.josh Posted August 31, 2008 Share Posted August 31, 2008 Well the code you posted here looks like it's been changed alot from the code in that link, so perhaps you should post your most current version? Quote Link to comment https://forums.phpfreaks.com/topic/121970-help-with-football-picks-entry-page/#findComment-630122 Share on other sites More sharing options...
SteveTs Posted August 31, 2008 Author Share Posted August 31, 2008 Well the code you posted here looks like it's been changed alot from the code in that link, so perhaps you should post your most current version? Thanks so much for your help. The "$_POST["opi"]" actually did help along with some other changes. Now a database entry is made, but only $currentweek and $currentyear are correct and the rest are blanks. Also, when I refresh the page it keep making new entries... but I assume that is because there is no $username in the db, so it does not stop at the $usernamet == "" statement. Here is the most recent version: <?php chdir("../forum/"); require('global.php'); chdir("../sports/"); require_once('mainfile.php'); $currentweek = "1"; $currentyear = "2008"; ?> <html> <head> <title>NFL Football Weekly Predictions: Week <?php echo"$currentweek"; ?> NFL National Football League Pick Em Pool</title> <meta name="ROBOTS" content="ALL, FOLLOW, INDEX"> <meta name="KEYWORDS" content="Pro Sports, Fantasy Sports, NFL Weekly Predictions, NFL National Football League"> <meta name="DESCRIPTION" content="Pro Sports, Fantasy Sports, NFL Weekly Predictions, NFL National Football League"> <meta name="PRODUCT" content=""> <meta name="CATEGORY" content=""> <meta name="CULTURE" content="en-US"> <meta name="LANGUAGE" content="en"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <?php include ("http://www.tmrzoo.com/includes/header-sports.php"); ?> <?php echo "<table width=\"645\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" height=100%> <tr> <td width=645 valign=top> <img src=\"/images/nfl/transpdot.gif\" width=645 height=1><br> <table border=0 cellpadding=9 cellspacing=0 width=100%> <tr><td width=100% valign=top> <table border=0 cellpadding=0 cellspacing=0 width=100%> <tr> <td valign=top> <font class=headlinetitle><b>Week $currentweek NFL House Predictions</b></font><br> <img src=\"/images/nfl/transpdot.gif\" width=1 height=5><br><font class=headlinetext>"; global $user, $cookie, $prefix, $dbi; if ($_POST['opi'] != "ds") { if ($vbulletin->userinfo['userid']!=0) { $username2 = $vbulletin->userinfo['username']; } $result = mysql_query("SELECT username FROM sports_football_predict_votes WHERE username = '$username2' AND week = '$currentweek' AND year = '$currentyear' ", $dbi); $myrow = mysql_fetch_array($result); $usernamet = $myrow["username"]; if ($usernamet == "") { $username = $username2; if ($vbulletin->userinfo['userid']!=0) { echo " $username, Think you're a pick-em god? Show what you've got by agreeing or disagreeing with each of Steve's psychic selections every week. If he scores more wins, the forum bragging will be endless. If you, the members, as a collective can topple him we'll deposit a TMR shirt on one of your doorsteps. Running results will appear after your choices are submitted. Good luck!</td>"; } else { echo"<b><font color=\"#CC0000\">You are not logged in</b></font> <p> You must be a member to participate in Beat the House. Registration is free and takes seconds to complete. <p><center><a href=\"http://www.tmrzoo.com/forum/register.php?\">register at The TMRzoo</a> | <a href=\"http://www.tmrzoo.com/forum\">Login</a></center></td>"; } echo "<td width=15><img src=\"/images/nfl/transpdot.gif\" width=15 height=165></td> <td valign=top align=right width=318> <table border=0 cellpadding=0 cellspacing=0 width=100%> <tr> <td background=\"/images/pickembkg.jpg\" width=318 height=134 valign=top> <table border=0 cellpadding=0 cellspacing=0 width=305> <tr> <td valign=top><img src=\/images/nfl/transpdot.gif\" width=155 height=1><br></td> <td valign=top width=250> <img src=\"/images/nfl/transpdot.gif\" width=1 height=9><br> <table border=0 cellpadding=0 cellspacing=0 width=100%> <tr> <td><font class=newsfooterheader>leaders</font></td> <td align=right><a class=pickem href=\"football-predictions-leaders.php\">view all</a></td> </tr> </table> <img src=\"/images/nfl/transpdot.gif\" width=1 height=8><br> <table border=0 cellpadding=2 cellspacing=0 width=100%>"; $result4 = mysql_query("SELECT * FROM sports_football_predict_member WHERE year = '$currentyear' ORDER BY tally DESC limit 5", $dbi); while($row = mysql_fetch_array($result4)) { echo "<tr><td valign=top><font class=headlinetext>$row[username]</font></td><td align=right><font class=headlinetext>$row[tally]</font></td></tr>"; } echo " </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <table border=0 cellpadding=0 cellspacing=0><FORM METHOD=\"post\" ACTION=\"football-predictions.php\">"; $result = mysql_query("SELECT * FROM sports_football_predict WHERE week='$currentweek' and year='$currentyear' order by id", $dbi); while(list($id, $year, $week, $home, $away, $prediction) = sql_fetch_row($result, $dbi)) { echo"<tr><td valign=top><img src=\"/images/nfl/helmets/$away.jpg\" width=55 height=50 align=left></td> <td valign=top><img src=\"/images/nfl/helmets/$home.jpg\" width=55 height=50 align=left></td> <td> </td> <td valign=top bgcolor=\"#B3CDC0\"> <table border=0 cellpadding=0 cellspacing=0> <tr><td><img src=\"/images/nfl/bgbox-blueupperleft.gif\" width=9 height=9 border=0></td><td></td></tr> <tr><td></td><td valign=top> <table border=0 cellpadding=3 cellpadding=0><tr><td> <font class=headlinetext>$prediction<br> </td></tr></table></td></tr> <tr><td><img src=\"/images/nfl/bgbox-bluelowerleft.gif\" width=9 height=9 border=0></td><td></td></tr> </table> </td> <td valign=middle bgcolor=\"#435654\" width=100> <table border=0 cellpadding=3 cellspacing=0> <tr><td nowrap><input type=radio value=\"1\" name=\"a$id\"><font class=newsfooterheader> Agree</td></tr> <tr><td nowrap><input type=radio value=\"0\" name=\"a$id\"><font class=newsfooterheader> Disagree</td></tr> </table> </td> </tr><tr><td colspan=5> </td></tr>"; } if ($vbulletin->userinfo['userid']!=0) { echo "<tr><td colspan=2></td><td colspan=3><center> <INPUT type=\"hidden\" name=\"opi\" value=\"ds\"> <INPUT type=\"hidden\" name=\"username\" value=\"$username\"> <center> <table border=0 cellpadding=0 cellspacing=0 width=162 height=28> <tr> <td width=162 height=28><center><input type=image src=\"/images/nfl/linkbg.gif\" name=submit width=162 height=28></td> </tr> </table></center></td></form></tr></table><p>"; } else { echo"<tr><td colspan=2></td><td colspan=2><center><font class=headlinetext><p><b><font color=\"#CC0000\">You are not logged in</b></font> <p> You must be a member to participate in Beat the House. Registration is free and takes seconds to complete. <p><center><a href=\"http://www.tmrzoo.com/forum/register.php?\">register at The Zoo</a> | <a href=\"http://www.tmrzoo.com/forum\">Login</a></center></td></tr></table>"; } } else { // ALREADY VOTED $profield = 0; echo "You've already submitted this week's picks. <p> The weekly member leaderboard and Steve's recap will appear the day after the final game of the week. <p> Check back here often to see how the member percentages shift versus Steve's picks.</td> <td width=15><img src=\"/images/nfl/transpdot.gif\" width=15 height=165></td> <td valign=top align=right width=318> <table border=0 cellpadding=0 cellspacing=0 width=100%> <tr> <td background=\"/images/pickembkg.jpg\" width=318 height=134 valign=top> <table border=0 cellpadding=0 cellspacing=0 width=305> <tr> <td valign=top><img src=\"/images/nfl/transpdot.gif\" width=155 height=1><br></td> <td valign=top width=250> <img src=\"/images/nfl/transpdot.gif\" width=1 height=9><br> <table border=0 cellpadding=0 cellspacing=0 width=100%> <tr> <td><font class=newsfooterheader>leaders</font></td> <td align=right><a class=pickem href=\"football-predictions-leaders.php\">view all</a></td> </tr> </table> <img src=\"/images/nfl/transpdot.gif\" width=1 height=8><br> <table border=0 cellpadding=2 cellspacing=0 width=100%>"; $result4 = mysql_query("SELECT * FROM sports_football_predict_member WHERE year = '$currentyear' ORDER BY tally DESC limit 5", $dbi); while($row = mysql_fetch_array($result4)) { echo "<tr><td valign=top><font class=headlinetext>$row[username]</font></td><td align=right><font class=headlinetext>$row[tally]</font></td></tr>"; } echo " </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <table border=0 cellpadding=0 cellspacing=0>"; $result = mysql_query("SELECT * FROM sports_football_predict WHERE week='$currentweek' AND year='$currentyear' order by id", $dbi); while($row = mysql_fetch_array($result)) { $profield = $profield + 1; $profield2 = "pro$profield"; $resultfor = mysql_query("SELECT * FROM sports_football_predict_votes WHERE week = '$currentweek' AND $profield2 = '1' AND year='$currentyear' AND username != 'Tomahoochi' $querylang", $dbi); $numresultsfor = sql_num_rows($resultfor, $dbi); $resultagainst = mysql_query("SELECT * FROM sports_football_predict_votes WHERE week = '$currentweek' AND $profield2 = '0' AND year='$currentyear' AND username != 'Tomahoochi' $querylang", $dbi); $numresultsagainst = sql_num_rows($resultagainst, $dbi); $numresultstotal = 0; $numresultstotal = $numresultsfor + $numresultsagainst; $forscore = 0; $forscore = number_format((($numresultsfor / $numresultstotal) * 100), 1); $againstscore = 0; $againstscore = number_format(($numresultsagainst / $numresultstotal) * 100, 1); echo"<tr><td valign=top><img src=\"/images/nfl/helmets/$row[away].jpg\" width=55 height=50 align=left></td> <td valign=top><img src=\"/images/nfl/helmets/$row[home].jpg\" width=55 height=50 align=left></td> <td> </td> <td valign=top bgcolor=\"#B3CDC0\"> <table border=0 cellpadding=0 cellspacing=0> <tr><td><img src=\"/images/nfl/bgbox-blueupperleft.gif\" width=9 height=9 border=0></td><td></td></tr> <tr><td></td><td valign=top> <table border=0 cellpadding=3 cellpadding=0><tr><td> <font class=headlinetext>$row[prediction]<br> </td></tr></table></td></tr> <tr><td><img src=\"/images/nfl/bgbox-bluelowerleft.gif\" width=9 height=9 border=0></td><td></td></tr> </table> </td> <td valign=middle bgcolor=\"#435654\" width=100> <table border=0 cellpadding=4 cellspacing=0> <tr><td nowrap align=right><font class=newsfooterheader>for</font></td><td nowrap width=50> <img src=\"/images/nfl/bar.gif\" width=$forscore% height=12></td><td><td nowrap><font class=newsfooterheader><b>$forscore %</b></td></tr> <tr><td nowrap align=right><font class=newsfooterheader>against</font></td><td nowrap width=50> <img src=\"/images/nfl/bar.gif\" width=$againstscore% height=12></td><td><td nowrap><font class=newsfooterheader><b>$againstscore %</b></td></tr> </table> </td></tr> <tr><td colspan=5> </td></tr>"; } echo "</table>"; } } else if ($_POST["opi"] == "ds") { $username2 = $username; $result = mysql_query("SELECT username FROM sports_football_predict_votes WHERE username = '$username2' AND week = '$currentweek' AND year='$currentyear' ", $dbi); $myrow = mysql_fetch_array($result); $usernamet = $myrow["username"]; if ($usernamet == "") { $username = $username2; mysql_query("INSERT INTO sports_football_predict_votes VALUES (NULL, '$currentyear', '$currentweek', '$username', '$a774', '$a775', '$a776', '$a777', '$a778', '$a779', '$a780', '$a781', '$a782', '$a783', '$a784', '$a785', '$a786', '$a787', '$a788', '$a789')"); } else { } $profield = 0; echo "Your choices are in and the running tallies are below. <p> The weekly member leaderboard and Steve's recap will appear the day after the final game of the week. <p> Check back here often to see how the member percentages shift versus Steve's picks.</td> <td width=15><img src=\"/images/nfl/transpdot.gif\" width=15 height=165></td> <td valign=top align=right width=318> <table border=0 cellpadding=0 cellspacing=0 width=100%> <tr> <td background=\"/images/pickembkg.jpg\" width=318 height=134 valign=top> <table border=0 cellpadding=0 cellspacing=0 width=305> <tr> <td valign=top><img src=\"/images/nfl/transpdot.gif\" width=155 height=1><br></td> <td valign=top width=250> <img src=\"/images/nfl/transpdot.gif\" width=1 height=9><br> <table border=0 cellpadding=0 cellspacing=0 width=100%> <tr> <td><font class=newsfooterheader>leaders</font></td> <td align=right><a class=pickem href=\"football-predictions-leaders.php\">view all</a></td> </tr> </table> <img src=\"/images/nfl/transpdot.gif\" width=1 height=8><br> <table border=0 cellpadding=2 cellspacing=0 width=100%>"; $result4 = mysql_query("SELECT * FROM sports_football_predict_member WHERE year = '$currentyear' ORDER BY tally DESC limit 5", $dbi); while($row = mysql_fetch_array($result4)) { echo "<tr><td valign=top><font class=headlinetext>$row[username]</font></td><td align=right><font class=headlinetext>$row[tally]</font></td></tr>"; } echo " </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <table border=0 cellpadding=0 cellspacing=0>"; $result = mysql_query("SELECT * FROM sports_football_predict WHERE week='$currentweek' AND year='$currentyear' order by id", $dbi); while($row = mysql_fetch_array($result)) { $profield = $profield + 1; $profield2 = "pro$profield"; $resultfor = mysql_query("SELECT * FROM sports_football_predict_votes WHERE week = '$currentweek' AND $profield2 = '1' AND year='$currentyear' AND username != 'Tomahoochi' $querylang", $dbi); $numresultsfor = sql_num_rows($resultfor, $dbi); $resultagainst = mysql_query("SELECT * FROM sports_football_predict_votes WHERE week = '$currentweek' AND $profield2 = '0' AND year='$currentyear' AND username != 'Tomahoochi' $querylang", $dbi); $numresultsagainst = sql_num_rows($resultagainst); $numresultstotal = 0; $numresultstotal = $numresultsfor + $numresultsagainst; $forscore = 0; $forscore = number_format((($numresultsfor / $numresultstotal) * 100), 1); $againstscore = 0; $againstscore = number_format((($numresultsagainst / $numresultstotal) * 100), 1); echo"<tr><td valign=top><img src=\"/images/nfl/helmets/$row[away].jpg\" width=55 height=50 align=left></td> <td valign=top><img src=\"/images/nfl/helmets/$row[home].jpg\" width=55 height=50 align=left></td> <td> </td> <td valign=top bgcolor=\"#B3CDC0\"> <table border=0 cellpadding=0 cellspacing=0> <tr><td><img src=\"/images/nfl/bgbox-blueupperleft.gif\" width=9 height=9 border=0></td><td></td></tr> <tr><td></td><td valign=top> <table border=0 cellpadding=3 cellpadding=0><tr><td> <font class=headlinetext>$row[prediction]<br> </td></tr></table></td></tr> <tr><td><img src=\"/images/nfl/bgbox-bluelowerleft.gif\" width=9 height=9 border=0></td><td></td></tr> </table> </td> <td valign=middle bgcolor=\"#435654\" width=100> <table border=0 cellpadding=4 cellspacing=0> <tr><td nowrap align=right><font class=newsfooterheader>for</font></td><td nowrap width=50> <img src=\"/images/nfl/bar.gif\" width=$forscore% height=12></td><td><td nowrap><font class=newsfooterheader><b>$forscore %</b></td></tr> <tr><td nowrap align=right><font class=newsfooterheader>against</font></td><td nowrap width=50> <img src=\"/images/nfl/bar.gif\" width=$againstscore% height=12></td><td><td nowrap><font class=newsfooterheader><b>$againstscore %</b></td></tr> </table> </td></tr> <tr><td colspan=5> </td></tr>"; } echo "</table>"; } echo "</td></tr></table>"; // include ("includes/footer-sports.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/121970-help-with-football-picks-entry-page/#findComment-630182 Share on other sites More sharing options...
.josh Posted August 31, 2008 Share Posted August 31, 2008 okay it looks like $username is not showing up for the same reason as opi: you need to use $_POST['username'] in the appropriate place(s) because that's what your form var is going to be called when the form is submitted. I also notice in your insert query you have a bunch of $a7xx vars being inserted but I don't see anywhere in that script where those are coming from, be it a form or some other assignment; that is, the only place in your script I see mention of those vars is in your insert query, so unless those vars are somehow being assigned in your require files at the top of your script, nothing is going to be inserted into the db in those fields. Quote Link to comment https://forums.phpfreaks.com/topic/121970-help-with-football-picks-entry-page/#findComment-630341 Share on other sites More sharing options...
SteveTs Posted August 31, 2008 Author Share Posted August 31, 2008 Actually the "post" issue was the same for all the insert variables... so I changed them all to the following and they are now writing to the db: mysql_query("INSERT INTO sports_football_predict_votes VALUES (NULL, '$currentyear', '$currentweek', '{$_POST['username']}', '{$_POST['a774']}', '{$_POST['a775']}', '{$_POST['a776']}', '{$_POST['a777']}', '{$_POST['a778']}', '{$_POST['a779']}', '{$_POST['a780']}', '{$_POST['a781']}', '{$_POST['a782']}', '{$_POST['a783']}', '{$_POST['a784']}', '{$_POST['a785']}', '{$_POST['a786']}', '{$_POST['a787']}', '{$_POST['a788']}', '{$_POST['a789']}')"); The $a7xx variables are the 0 and 1 values from the radio buttons. They are working ok now. The only issue I seem to be running into now is that after I complete the entry, I correctly see the page with the pick selections, but if I open the page in a new browser, I get the entry page again as if no selections were entered. If I hit refresh, they go away and i see the page I'm supposed to see. Thanks for all your help on this. Quote Link to comment https://forums.phpfreaks.com/topic/121970-help-with-football-picks-entry-page/#findComment-630399 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.