User prioritizing a table array

I am looking for a code snippet either php, ajax or java that updates a mysql table of a users picks based on how they prioritize them.

the table is for an office pool of weekly nfl picks.

The table picks has the structure of userid, gameid, pickid and points. There is one row for each user for each game. I want to implement instead of points being 1 for each game, the user selects 1 through 15 (or however many games there are that week. And it doesn’t let them pick any number twice, but I need to get it to update the table like that 1st. I am very new to coding especially understanding arrays and loops. I got the other pages to recognise the points, but I am having trouble getting this form to pass points to the table and also need to find something to validate it.

[code]<?php
require_once(‘includes/application_top.php’);
require(‘includes/classes/team.php’);

if ($_POST[‘action’] == ‘Submit’) {
$week = $_POST[‘week’];
$cutoffDateTime = getCutoffDateTime($week);

//update summary table
$sql = "delete from " . $db_prefix . "picksummary where weekNum = " . $_POST['week'] . " and userID = " . $user->userID . ";";
mysql_query($sql) or die('Error updating picks summary: ' . mysql_error());
$sql = "insert into " . $db_prefix . "picksummary (weekNum, userID, showPicks) values (" . $_POST['week'] . ", " . $user->userID . ", " . (int)$_POST['showPicks'] . ");";
mysql_query($sql) or die('Error updating picks summary: ' . mysql_error());

//loop through non-expire weeks and update picks
$sql = "select * from " . $db_prefix . "schedule where weekNum = " . $_POST['week'] . " and (DATE_ADD(NOW(), INTERVAL " . SERVER_TIMEZONE_OFFSET . " HOUR) < gameTimeEastern and DATE_ADD(NOW(), INTERVAL " . SERVER_TIMEZONE_OFFSET . " HOUR) < '" . $cutoffDateTime . "');";
$query = mysql_query($sql);
while ($result = mysql_fetch_array($query)) {
	$sql = "delete from " . $db_prefix . "picks where userID = " . $user->userID . " and gameID = " . $result['gameID'];
	mysql_query($sql) or die('Error deleting picks: ' . mysql_error());
	
	if (!empty($_POST['game' . $result['gameID']])) {
		$sql = "insert into " . $db_prefix . "picks (userID, gameID, pickID, points) values (" . $user->userID . ", " . $result['gameID'] . ", '" . $_POST['game' . $result['gameID']] . ", " . (int)$result['points'] . "')";
		mysql_query($sql) or die('Error inserting pick: ' . mysql_error());
	}
}
header('Location: results.php?week=' . $_POST['week']);

} else {
$week = (int)$_GET[‘week’];
if (empty($week)) {
//get current week
$week = (int)getCurrentWeek();
}
$cutoffDateTime = getCutoffDateTime($week);
$firstGameTime = getFirstGameTime($week);
}

include(‘includes/header.php’);
include(‘includes/column_right.php’);

//display week nav
$sql = "select distinct weekNum from " . $db_prefix . “schedule order by weekNum;”;
$query = mysql_query($sql);
$weekNav = '

Go to week: ';
$i = 0;
while ($result = mysql_fetch_array($query)) {
if ($i > 0) $weekNav .= ’ | ';
if ($week !== (int)$result[‘weekNum’]) {
$weekNav .= ‘’ . $result[‘weekNum’] . ‘’;
} else {
$weekNav .= $result[‘weekNum’];
}
$i++;
}
$weekNav .= ‘
’ . “\n”;
echo $weekNav;
?>
			<h2>Week <?php echo $week; ?> - Make Your Picks:</h2>
			<p>Make your picks below by clicking on the team helmet or checking the radio buttons to the right.</p>
			<script type="text/javascript">
			function checkform() {
				//make sure all picks have a checked value
				var f = document.entryForm;
				var allChecked = true;
				var allR = document.getElementsByTagName('input');
				for (var i=0; i < allR.length; i++) {
					if(allR[i].type == 'radio') {
						if (!radioIsChecked(allR[i].name)) {
							allChecked = false;
						}
					}      
			    }
			    if (!allChecked) {
					return confirm('One or more picks are missing for the current week.  Do you wish to submit anyway?');
				}
				return true;
			}
			function radioIsChecked(elmName) {
				var elements = document.getElementsByName(elmName);
				for (var i = 0; i < elements.length; i++) {
					if (elements[i].checked) {
						return true;
					}
				}
				return false;
			}
			</script>
<div style="float: right; width: 270px; margin-right: 10px"><?php include('includes/comments.php'); ?></div>
<?php
//get existing picks
$picks = getUserPicks($week, $user->userID);

//get show picks status
$sql = "select * from " . $db_prefix . "picksummary where weekNum = " . $week . " and userID = " . $user->userID . ";";
$query = mysql_query($sql);
if (mysql_num_rows($query) > 0) {
	$result = mysql_fetch_array($query);
	$showPicks = (int)$result['showPicks'];
} else {
	$showPicks = 1;
}

//display schedule for week
$sql = "select s.*, (DATE_ADD(NOW(), INTERVAL " . SERVER_TIMEZONE_OFFSET . " HOUR) > gameTimeEastern or DATE_ADD(NOW(), INTERVAL " . SERVER_TIMEZONE_OFFSET . " HOUR) > '" . $cutoffDateTime . "')  as expired ";
$sql .= "from " . $db_prefix . "schedule s ";
$sql .= "inner join " . $db_prefix . "teams ht on s.homeID = ht.teamID ";
$sql .= "inner join " . $db_prefix . "teams vt on s.visitorID = vt.teamID ";
$sql .= "where s.weekNum = " . $week . " ";
$sql .= "order by s.gameTimeEastern, s.gameID";
//echo $sql;
$query = mysql_query($sql);
if (mysql_num_rows($query) > 0) {
	echo '<form name="entryForm" action="entry_form.php" method="post" onsubmit="return checkform();">' . "\n";
	echo '<input type="hidden" name="week" value="' . $week . '" />' . "\n";
	echo '<table cellpadding="4" cellspacing="0" class="table1">' . "\n";
	//echo '	<tr><th>Home</th><th>Visitor</th><th align="left">Game</th><th>Time / Result</th><th>Your Pick</th></tr>' . "\n";
	$i = 0;
	while ($result = mysql_fetch_array($query)) {
		$homeTeam = new team($result['homeID']);
		$visitorTeam = new team($result['visitorID']);
		$rowclass = (($i % 2 == 0) ? ' class="altrow"' : '');
		//$pickExpired = ((date("U") > strtotime($result['gameTimeEastern'])) ? true : false);
		echo '		<tr' . $rowclass . '>' . "\n";
		echo '			<td align="center">' . "\n";
		echo '				<table width="100%" border="0" cellpadding="2" cellspacing="0" class="nostyle">' . "\n";
		echo '					<tr valign="middle">' . "\n";
		echo '						<td align="center"><label for="' . $result['gameID'] . $visitorTeam->teamID . '"><img src="images/helmets_big/' . strtolower($visitorTeam->teamID) . '1.gif" onclick="document.entryForm.game' . $result['gameID'] . '[0].checked=true;" /></label><br /><span style="font-size: 9px;"><b>' . $visitorTeam->city . ' ' . $visitorTeam->team . '</b><br />Record: ' . getTeamRecord($visitorTeam->teamID) . '<br />Streak: ' . getTeamStreak($visitorTeam->teamID) . '</span></td>' . "\n";
		echo '						<td align="center">at</td>' . "\n";
		echo '						<td align="center"><label for="' . $result['gameID'] . $homeTeam->teamID . '"><img src="images/helmets_big/' . strtolower($homeTeam->teamID) . '2.gif" onclick="document.entryForm.game' . $result['gameID'] . '[1].checked=true;" /></label><br /><span style="font-size: 9px;"><b>' . $homeTeam->city . ' ' . $homeTeam->team . '</b><br />Record: ' . getTeamRecord($homeTeam->teamID) . '<br />Streak: ' . getTeamStreak($homeTeam->teamID) . '</span></td>' . "\n";
		echo '					</tr>' . "\n";
		if (strlen($result['homeScore']) > 0 && strlen($result['visitorScore']) > 0) {
			//if score is entered, show score
			echo '					<tr><td colspan="3" align="center"><b>Final: ' . $result['visitorScore'] . ' - ' . $result['homeScore'] . '</b></td></tr>' . "\n";
		} else {
			//else show time of game
			echo '					<tr><td colspan="3" align="center">' . date('D n/j g:i a', strtotime($result['gameTimeEastern'])) . ' ET</td></tr>' . "\n";
		}
		echo '				</table>' . "\n";
		echo '			</td>' . "\n";
		echo '			<td align="left"><b>Your Pick:</b><br />' . "\n";
		if (!$result['expired']) {
			//if game is not expired, show pick
			echo '			<input type="radio" name="game' . $result['gameID'] . '" value="' . $visitorTeam->teamID . '" id="' . $result['gameID'] . $visitorTeam->teamID . '"' . (($picks[$result['gameID']]['pickID'] == $visitorTeam->teamID) ? ' checked="checked"' : '') . ' /> <label for="' . $result['gameID'] . $visitorTeam->teamID . '">' . $visitorTeam->teamName . '</label><br />' . "\n";
			echo '			<input type="radio" name="game' . $result['gameID'] . '" value="' . $homeTeam->teamID . '" id="' . $result['gameID'] . $homeTeam->teamID . '"' . (($picks[$result['gameID']]['pickID'] == $homeTeam->teamID) ? ' checked="checked"' : '') . ' /> <label for="' . $result['gameID'] . $homeTeam->teamID . '">' . $homeTeam->teamName . '</label><br />' . "\n";
			echo '			<input type="number" min="1" max="15" name="points" value="' . $result['points'] . '"/><br />' . "\n";
			
		} else {
			//else show locked pick
			$pickID = getPickID($result['gameID'], $user->userID);
			if (!empty($pickID)) {
				$statusImg = '';
				$pickTeam = new team($pickID);
				$pickLabel = $pickTeam->teamName;
                          
			} else {
				$statusImg = '<img src="images/cross_16x16.png" width="16" height="16" alt="" />';
				$pickLabel = 'None Selected';
			}
			if ($scoreEntered) {
				//set status of pick (correct, incorrect)
				if ($pickID == $result['winnerID']) {
					$statusImg = '<img src="images/check_16x16.png" width="16" height="16" alt="" />';
				} else {
					$statusImg = '<img src="images/cross_16x16.png" width="16" height="16" alt="" />';
				}
			}
			echo '			' . $statusImg . ' ' . $pickLabel . "\n";
		}
		echo '			</td>' . "\n";
		echo '		</tr>' . "\n";
		$i++;
	}
	echo '</table>' . "\n";
	echo '<p><input type="checkbox" name="showPicks" id="showPicks" value="1"' . (($showPicks) ? ' checked="checked"' : '') . ' /> <label for="showPicks">Allow others to see my picks</label></p>' . "\n";
	echo '<p><input type="submit" name="action" value="Submit" /></p>' . "\n";
	echo '</form>' . "\n";
}
?>
<?php include('includes/footer.php'); ?>[/code]

I am really looking for help here. I know I’m a newby but I don’t know where to turn.

Before I validate the points for prioritizing it, I need to get this properly posting to the data base.

I have updated the above code and now I got the old points at least showing up in the input box, but it is not writing new values to the database when submitted.

I tried putting it in the insert statement, I tried adding the update statement. Somehow I need to get it from the input box into the database in the db record field ‘points’.

This is my latest attempt

[php]<?php
require_once(‘includes/application_top.php’);
require(‘includes/classes/team.php’);

if ($_POST[‘action’] == ‘Submit’) {
$week = $_POST[‘week’];
$cutoffDateTime = getCutoffDateTime($week);

//update summary table
$sql = "delete from " . $db_prefix . "picksummary where weekNum = " . $_POST['week'] . " and userID = " . $user->userID . ";";
mysql_query($sql) or die('Error updating picks summary: ' . mysql_error());
$sql = "insert into " . $db_prefix . "picksummary (weekNum, userID, showPicks) values (" . $_POST['week'] . ", " . $user->userID . ", " . (int)$_POST['showPicks'] . ");";
mysql_query($sql) or die('Error updating picks summary: ' . mysql_error());

//loop through non-expire weeks and update picks
$sql = "select * from " . $db_prefix . "schedule where weekNum = " . $_POST['week'] . " and (DATE_ADD(NOW(), INTERVAL " . SERVER_TIMEZONE_OFFSET . " HOUR) < gameTimeEastern and DATE_ADD(NOW(), INTERVAL " . SERVER_TIMEZONE_OFFSET . " HOUR) < '" . $cutoffDateTime . "');";
$query = mysql_query($sql);
while ($result = mysql_fetch_array($query)) {
	$sql = "delete from " . $db_prefix . "picks where userID = " . $user->userID . " and gameID = " . $result['gameID'];
	mysql_query($sql) or die('Error deleting picks: ' . mysql_error());
	
	if (!empty($_POST['game' . $result['gameID']])) {
		$sql = "insert into " . $db_prefix . "picks (userID, gameID, pickID) values (" . $user->userID . ", " . $result['gameID'] . ", '" . $_POST['game' . $result['gameID']] . ");
                      update " . $db_prefix . "picks SET 'points' = ". (int)$_POST['points' . $result['gameID']] ." WHERE 'userID' = " . $user . " and 'gameID' = " . $result['gameID'] . " LIMIT 1 ;";
		mysql_query($sql) or die('Error inserting pick: ' . mysql_error()); 
	}
}
header('Location: results.php?week=' . $_POST['week']);

} else {
$week = (int)$_GET[‘week’];
if (empty($week)) {
//get current week
$week = (int)getCurrentWeek();
}
$cutoffDateTime = getCutoffDateTime($week);
$firstGameTime = getFirstGameTime($week);
}

include(‘includes/header.php’);
include(‘includes/column_right.php’);

//display week nav
$sql = "select distinct weekNum from " . $db_prefix . “schedule order by weekNum;”;
$query = mysql_query($sql);
$weekNav = '

Go to week: ';
$i = 0;
while ($result = mysql_fetch_array($query)) {
if ($i > 0) $weekNav .= ’ | ';
if ($week !== (int)$result[‘weekNum’]) {
$weekNav .= ‘’ . $result[‘weekNum’] . ‘’;
} else {
$weekNav .= $result[‘weekNum’];
}
$i++;
}
$weekNav .= ‘
’ . “\n”;
echo $weekNav;
?>
			<h2>Week <?php echo $week; ?> - Make Your Picks:</h2>
			<p>Make your picks below by clicking on the team helmet or checking the radio buttons to the right.</p>
			<script type="text/javascript">
			function checkform() {
				//make sure all picks have a checked value
				var f = document.entryForm;
				var allChecked = true;
				var allR = document.getElementsByTagName('input');
				for (var i=0; i < allR.length; i++) {
					if(allR[i].type == 'radio') {
						if (!radioIsChecked(allR[i].name)) {
							allChecked = false;
						}
					}      
			    }
			    if (!allChecked) {
					return confirm('One or more picks are missing for the current week.  Do you wish to submit anyway?');
				}
				return true;
			}
			function radioIsChecked(elmName) {
				var elements = document.getElementsByName(elmName);
				for (var i = 0; i < elements.length; i++) {
					if (elements[i].checked) {
						return true;
					}
				}
				return false;
			}
			</script>
<div style="float: right; width: 270px; margin-right: 10px"><?php include('includes/comments.php'); ?></div>
<?php
//get existing picks
$picks = getUserPicks($week, $user->userID);
$points = array();
$points = $picks;

//get show picks status
$sql = "select * from " . $db_prefix . "picksummary where weekNum = " . $week . " and userID = " . $user->userID . ";";
$query = mysql_query($sql);
if (mysql_num_rows($query) > 0) {
	$result = mysql_fetch_array($query);
	$showPicks = (int)$result['showPicks'];
} else {
	$showPicks = 1;
}

//display schedule for week
$sql = "select s.*, (DATE_ADD(NOW(), INTERVAL " . SERVER_TIMEZONE_OFFSET . " HOUR) > gameTimeEastern or DATE_ADD(NOW(), INTERVAL " . SERVER_TIMEZONE_OFFSET . " HOUR) > '" . $cutoffDateTime . "')  as expired ";
$sql .= "from " . $db_prefix . "schedule s ";
$sql .= "inner join " . $db_prefix . "teams ht on s.homeID = ht.teamID ";
$sql .= "inner join " . $db_prefix . "teams vt on s.visitorID = vt.teamID ";
$sql .= "where s.weekNum = " . $week . " ";
$sql .= "order by s.gameTimeEastern, s.gameID";
//echo $sql;
$query = mysql_query($sql);
if (mysql_num_rows($query) > 0) {
	echo '<form name="entryForm" action="entry_form.php" method="post" onsubmit="return checkform();">' . "\n";
	echo '<input type="hidden" name="week" value="' . $week . '" />' . "\n";
	echo '<table cellpadding="4" cellspacing="0" class="table1">' . "\n";
	//echo '	<tr><th>Home</th><th>Visitor</th><th align="left">Game</th><th>Time / Result</th><th>Your Pick</th></tr>' . "\n";
	$i = 0;
	while ($result = mysql_fetch_array($query)) {
		$homeTeam = new team($result['homeID']);
		$visitorTeam = new team($result['visitorID']);
		$rowclass = (($i % 2 == 0) ? ' class="altrow"' : '');
		//$pickExpired = ((date("U") > strtotime($result['gameTimeEastern'])) ? true : false);
		echo '		<tr' . $rowclass . '>' . "\n";
		echo '			<td align="center">' . "\n";
		echo '				<table width="100%" border="0" cellpadding="2" cellspacing="0" class="nostyle">' . "\n";
		echo '					<tr valign="middle">' . "\n";
		echo '						<td align="center"><label for="' . $result['gameID'] . $visitorTeam->teamID . '"><img src="images/helmets_big/' . strtolower($visitorTeam->teamID) . '1.gif" onclick="document.entryForm.game' . $result['gameID'] . '[0].checked=true;" /></label><br /><span style="font-size: 9px;"><b>' . $visitorTeam->city . ' ' . $visitorTeam->team . '</b><br />Record: ' . getTeamRecord($visitorTeam->teamID) . '<br />Streak: ' . getTeamStreak($visitorTeam->teamID) . '</span></td>' . "\n";
		echo '						<td align="center">at</td>' . "\n";
		echo '						<td align="center"><label for="' . $result['gameID'] . $homeTeam->teamID . '"><img src="images/helmets_big/' . strtolower($homeTeam->teamID) . '2.gif" onclick="document.entryForm.game' . $result['gameID'] . '[1].checked=true;" /></label><br /><span style="font-size: 9px;"><b>' . $homeTeam->city . ' ' . $homeTeam->team . '</b><br />Record: ' . getTeamRecord($homeTeam->teamID) . '<br />Streak: ' . getTeamStreak($homeTeam->teamID) . '</span></td>' . "\n";
		echo '					</tr>' . "\n";
		if (strlen($result['homeScore']) > 0 && strlen($result['visitorScore']) > 0) {
			//if score is entered, show score
			echo '					<tr><td colspan="3" align="center"><b>Final: ' . $result['visitorScore'] . ' - ' . $result['homeScore'] . '</b></td></tr>' . "\n";
		} else {
			//else show time of game
			echo '					<tr><td colspan="3" align="center">' . date('D n/j g:i a', strtotime($result['gameTimeEastern'])) . ' ET</td></tr>' . "\n";
		}
		echo '				</table>' . "\n";
		echo '			</td>' . "\n";
		echo '			<td align="left"><b>Your Pick:</b><br />' . "\n";
		if (!$result['expired']) {
			//if game is not expired, show pick
			echo '			<input type="radio" name="game' . $result['gameID'] . '" value="' . $visitorTeam->teamID . '" id="' . $result['gameID'] . $visitorTeam->teamID . '"' . (($picks[$result['gameID']]['pickID'] == $visitorTeam->teamID) ? ' checked="checked"' : '') . ' /> <label for="' . $result['gameID'] . $visitorTeam->teamID . '">' . $visitorTeam->teamName . '</label><br />' . "\n";
			echo '			<input type="radio" name="game' . $result['gameID'] . '" value="' . $homeTeam->teamID . '" id="' . $result['gameID'] . $homeTeam->teamID . '"' . (( $picks[$result['gameID']]['pickID'] == $homeTeam->teamID) ? ' checked="checked"' : '') . ' /> <label for="' . $result['gameID'] . $homeTeam->teamID . '">' . $homeTeam->teamName . '</label><br />' . "\n";
            echo '			<input type="number" min="1" max="15" name="points' . $result['gameID'] . '" value="' . $picks[$result['gameID']]['points']  . '"/><br />' . "\n";				
			
		} else {
			//else show locked pick
			$pickID = getPickID($result['gameID'], $user->userID);
			if (!empty($pickID)) {
				$statusImg = '';
				$pickTeam = new team($pickID);
				$pickLabel = $pickTeam->teamName;
                          
			} else {
				$statusImg = '<img src="images/cross_16x16.png" width="16" height="16" alt="" />';
				$pickLabel = 'None Selected';
			}
			if ($scoreEntered) {
				//set status of pick (correct, incorrect)
				if ($pickID == $result['winnerID']) {
					$statusImg = '<img src="images/check_16x16.png" width="16" height="16" alt="" />';
				} else {
					$statusImg = '<img src="images/cross_16x16.png" width="16" height="16" alt="" />';
				}
			}
			echo '			' . $statusImg . ' ' . $pickLabel . "\n";
		}
		echo '			</td>' . "\n";
		echo '		</tr>' . "\n";
		$i++;
	}
	echo '</table>' . "\n";
	echo '<p><input type="checkbox" name="showPicks" id="showPicks" value="1"' . (($showPicks) ? ' checked="checked"' : '') . ' /> <label for="showPicks">Allow others to see my picks</label></p>' . "\n";
	echo '<p><input type="submit" name="action" value="Submit" /></p>' . "\n";
	echo '</form>' . "\n";
}
?>
<?php include('includes/footer.php'); ?>[/php]

Could someone please look at this, the lines I am having trouble with are 23 and 150. ???

What trouble are you having with those line numbers?

It is not posting the points to the table. It is posting the other fields but the only thing showing in the db for points is the default value of 1.

Just glancing, Maybe this has something to do with it…

I looks like you are setting the value of the Game# to the team ID?

[php]echo ‘<input type=“radio” name="game’ . $result[‘gameID’] . ‘" value="’ . $homeTeam->teamID . ‘" id="’ . $result[‘gameID’] . $homeTeam->teamID . ‘"’ . (( $picks[$result[‘gameID’]][‘pickID’] == $homeTeam->teamID) ? ’ checked=“checked”’ : ‘’) . ’ />[/php]

Taken from the above?

[php] value="’ . $homeTeam->teamID . '" [/php]

It is writing those inputs correctly and if I display the source of the compiled page it is making the variable for points correctly.

source from browser (I chopped a bunch out to stay under post limit)
[php]

Your Pick:

Seattle Seahawks

Arizona Cardinals















Tampa Bay Buccaneers
Record: 0-5-0
Streak: L 5
at
Atlanta Falcons
Record: 1-4-0
Streak: L 3
Sun 10/20 1:00 pm ET


Your Pick:

Tampa Bay Buccaneers

Atlanta Falcons















Cincinnati Bengals
Record: 4-2-0
Streak: W 2
at
Detroit Lions
Record: 4-2-0
Streak: W 1
Sun 10/20 1:00 pm ET


Your Pick:

Cincinnati Bengals

Detroit Lions















Houston Texans
Record: 2-4-0
Streak: L 4
at
Kansas City Chiefs
Record: 6-0-0
Streak: W 6
Sun 10/20 1:00 pm ET


Your Pick:

> Houston Texans

Kansas City Chiefs















Buffalo Bills
Record: 2-4-0
Streak: L 2
at
Miami Dolphins
Record: 3-2-0
Streak: L 2
Sun 10/20 1:00 pm ET


Your Pick:

Buffalo Bills

Miami Dolphins















New England Patriots
Record: 5-1-0
Streak: W 1
at
New York Jets
Record: 3-3-0
Streak: L 1
Sun 10/20 1:00 pm ET


Your Pick:

New England Patriots

NY Jets















Dallas Cowboys
Record: 3-3-0
Streak: W 1
at
Philadelphia Eagles
Record: 3-3-0
Streak: W 2
Sun 10/20 1:00 pm ET

	</tr>

Allow others to see my picks

<!--

Latest Comments:</h2

comment

			</div>
		</td>
	</tr>
</table>

//–>

	</div>
	<div style="clear: both;"></div>
</div>
[/php]

And it is displaying the default value of 1 in the input box from this line from the $picks[$result[‘gameID’]][‘points’]

[php] echo ’
’ . “\n”;

[/php]

That helps…

[php]if (!empty($_POST[‘game’ . $result[‘gameID’]])) {
$sql = "insert into " . $db_prefix . “picks (userID, gameID, pickID) values (” . $user->userID . ", " . $result[‘gameID’] . “, '” . $_POST[‘game’ . $result[‘gameID’]] . ");
update " . $db_prefix . “picks SET ‘points’ = “. (int)$_POST[‘points’ . $result[‘gameID’]] .” WHERE ‘userID’ = " . $user . " and ‘gameID’ = " . $result[‘gameID’] . " LIMIT 1 ;”;
mysql_query($sql) or die('Error inserting pick: ’ . mysql_error());
}[/php]

Can you Echo the $sql? Like this and post the statement? Also is this a live website someplace I can look at it?

[php]if (!empty($_POST[‘game’ . $result[‘gameID’]])) {
$sql = "insert into " . $db_prefix . “picks (userID, gameID, pickID) values (” . $user->userID . ", " . $result[‘gameID’] . “, '” . $_POST[‘game’ . $result[‘gameID’]] . ");
update " . $db_prefix . “picks SET ‘points’ = “. (int)$_POST[‘points’ . $result[‘gameID’]] .” WHERE ‘userID’ = " . $user . " and ‘gameID’ = " . $result[‘gameID’] . " LIMIT 1 ;”;
mysql_query($sql) or die('Error inserting pick: ’ . mysql_error());
echo $sql;
exit;
}[/php]

Sure it is at http://elginturners.org/picker

You’ll have to create an account, but it is instant access not email verified.

When you go to entry_form.php , you’ll have to type entry_formweighted.php in the address bar as nothing is linked to this non-working page yet.

I tried echoing the variables but it redirects to results.php like instantly, even when I removed the Header redirect line ???

Thank you so much for looking at this.

this is my latest try what is live on server right now
[php]<?php
require_once(‘includes/application_top.php’);
require(‘includes/classes/team.php’);

if ($_POST[‘action’] == ‘Submit’) {
$week = $_POST[‘week’];
$cutoffDateTime = getCutoffDateTime($week);

//update summary table
$sql = "delete from " . $db_prefix . "picksummary where weekNum = " . $_POST['week'] . " and userID = " . $user->userID . ";";
mysql_query($sql) or die('Error updating picks summary: ' . mysql_error());
$sql = "insert into " . $db_prefix . "picksummary (weekNum, userID, showPicks) values (" . $_POST['week'] . ", " . $user->userID . ", " . (int)$_POST['showPicks'] . ");";
mysql_query($sql) or die('Error updating picks summary: ' . mysql_error());

//loop through non-expire weeks and update picks
$sql = "select * from " . $db_prefix . "schedule where weekNum = " . $_POST['week'] . " and (DATE_ADD(NOW(), INTERVAL " . SERVER_TIMEZONE_OFFSET . " HOUR) < gameTimeEastern and DATE_ADD(NOW(), INTERVAL " . SERVER_TIMEZONE_OFFSET . " HOUR) < '" . $cutoffDateTime . "');";
$query = mysql_query($sql);
while ($result = mysql_fetch_array($query)) {
	$sql = "delete from " . $db_prefix . "picks where userID = " . $user->userID . " and gameID = " . $result['gameID'];
	mysql_query($sql) or die('Error deleting picks: ' . mysql_error());
	
	if (!empty($_POST['game' . $result['gameID']])) {
               $pts = trim('points' . $result['gameID']);
		$pts = (int)$_POST['$pts'];
		$sql = "insert into " . $db_prefix . "picks (userID, gameID, pickID, points) values (" . $user->userID . ", " . $result['gameID'] . ", " . $_POST['game' . $result['gameID']] . ", " . $pts . ");";

      echo (int)$_POST['points' . $result['gameID']];
		mysql_query($sql) or die('Error inserting pick: ' . mysql_error()); 
	}
}
        
        header('Location: results.php?week=' . $_POST['week']);

} else {
$week = (int)$_GET[‘week’];
if (empty($week)) {
//get current week
$week = (int)getCurrentWeek();
}
$cutoffDateTime = getCutoffDateTime($week);
$firstGameTime = getFirstGameTime($week);
}

include(‘includes/header.php’);
include(‘includes/column_right.php’);

//display week nav
$sql = "select distinct weekNum from " . $db_prefix . “schedule order by weekNum;”;
$query = mysql_query($sql);
$weekNav = '

Go to week: ';
$i = 0;
while ($result = mysql_fetch_array($query)) {
if ($i > 0) $weekNav .= ’ | ';
if ($week !== (int)$result[‘weekNum’]) {
$weekNav .= ‘’ . $result[‘weekNum’] . ‘’;
} else {
$weekNav .= $result[‘weekNum’];
}
$i++;
}
$weekNav .= ‘
’ . “\n”;
echo $weekNav;
?>
			<h2>Week <?php echo $week; ?> - Make Your Picks:</h2>
			<p>Make your picks below by clicking on the team helmet or checking the radio buttons to the right.</p>
			<script type="text/javascript">
			function checkform() {
				//make sure all picks have a checked value
				var f = document.entryForm;
				var allChecked = true;
				var allR = document.getElementsByTagName('input');
				for (var i=0; i < allR.length; i++) {
					if(allR[i].type == 'radio') {
						if (!radioIsChecked(allR[i].name)) {
							allChecked = false;
						}
					}      
			    }
			    if (!allChecked) {
					return confirm('One or more picks are missing for the current week.  Do you wish to submit anyway?');
				}
				return true;
			}
			function radioIsChecked(elmName) {
				var elements = document.getElementsByName(elmName);
				for (var i = 0; i < elements.length; i++) {
					if (elements[i].checked) {
						return true;
					}
				}
				return false;
			}
			</script>
<div style="float: right; width: 270px; margin-right: 10px"><?php include('includes/comments.php'); ?></div>
<?php
//get existing picks
$picks = getUserPicks($week, $user->userID);
$points = array();
$points = $picks;

//get show picks status
$sql = "select * from " . $db_prefix . "picksummary where weekNum = " . $week . " and userID = " . $user->userID . ";";
$query = mysql_query($sql);
if (mysql_num_rows($query) > 0) {
	$result = mysql_fetch_array($query);
	$showPicks = (int)$result['showPicks'];
} else {
	$showPicks = 1;
}

//display schedule for week
$sql = "select s.*, (DATE_ADD(NOW(), INTERVAL " . SERVER_TIMEZONE_OFFSET . " HOUR) > gameTimeEastern or DATE_ADD(NOW(), INTERVAL " . SERVER_TIMEZONE_OFFSET . " HOUR) > '" . $cutoffDateTime . "')  as expired ";
$sql .= "from " . $db_prefix . "schedule s ";
$sql .= "inner join " . $db_prefix . "teams ht on s.homeID = ht.teamID ";
$sql .= "inner join " . $db_prefix . "teams vt on s.visitorID = vt.teamID ";
$sql .= "where s.weekNum = " . $week . " ";
$sql .= "order by s.gameTimeEastern, s.gameID";
//echo $sql;
$query = mysql_query($sql);
if (mysql_num_rows($query) > 0) {
	echo '<form name="entryForm" action="entry_form.php" method="post" onsubmit="return checkform();">' . "\n";
	echo '<input type="hidden" name="week" value="' . $week . '" />' . "\n";
	echo '<table cellpadding="4" cellspacing="0" class="table1">' . "\n";
	//echo '	<tr><th>Home</th><th>Visitor</th><th align="left">Game</th><th>Time / Result</th><th>Your Pick</th></tr>' . "\n";
	$i = 0;
	while ($result = mysql_fetch_array($query)) {
		$homeTeam = new team($result['homeID']);
		$visitorTeam = new team($result['visitorID']);
		$rowclass = (($i % 2 == 0) ? ' class="altrow"' : '');
		//$pickExpired = ((date("U") > strtotime($result['gameTimeEastern'])) ? true : false);
		echo '		<tr' . $rowclass . '>' . "\n";
		echo '			<td align="center">' . "\n";
		echo '				<table width="100%" border="0" cellpadding="2" cellspacing="0" class="nostyle">' . "\n";
		echo '					<tr valign="middle">' . "\n";
		echo '						<td align="center"><label for="' . $result['gameID'] . $visitorTeam->teamID . '"><img src="images/helmets_big/' . strtolower($visitorTeam->teamID) . '1.gif" onclick="document.entryForm.game' . $result['gameID'] . '[0].checked=true;" /></label><br /><span style="font-size: 9px;"><b>' . $visitorTeam->city . ' ' . $visitorTeam->team . '</b><br />Record: ' . getTeamRecord($visitorTeam->teamID) . '<br />Streak: ' . getTeamStreak($visitorTeam->teamID) . '</span></td>' . "\n";
		echo '						<td align="center">at</td>' . "\n";
		echo '						<td align="center"><label for="' . $result['gameID'] . $homeTeam->teamID . '"><img src="images/helmets_big/' . strtolower($homeTeam->teamID) . '2.gif" onclick="document.entryForm.game' . $result['gameID'] . '[1].checked=true;" /></label><br /><span style="font-size: 9px;"><b>' . $homeTeam->city . ' ' . $homeTeam->team . '</b><br />Record: ' . getTeamRecord($homeTeam->teamID) . '<br />Streak: ' . getTeamStreak($homeTeam->teamID) . '</span></td>' . "\n";
		echo '					</tr>' . "\n";
		if (strlen($result['homeScore']) > 0 && strlen($result['visitorScore']) > 0) {
			//if score is entered, show score
			echo '					<tr><td colspan="3" align="center"><b>Final: ' . $result['visitorScore'] . ' - ' . $result['homeScore'] . '</b></td></tr>' . "\n";
		} else {
			//else show time of game
			echo '					<tr><td colspan="3" align="center">' . date('D n/j g:i a', strtotime($result['gameTimeEastern'])) . ' ET</td></tr>' . "\n";
		}
		echo '				</table>' . "\n";
		echo '			</td>' . "\n";
		echo '			<td align="left"><b>Your Pick:</b><br />' . "\n";
		if (!$result['expired']) {
			//if game is not expired, show pick
			echo '			<input type="radio" name="game' . $result['gameID'] . '" value="' . $visitorTeam->teamID . '" id="' . $result['gameID'] . $visitorTeam->teamID . '"' . (($picks[$result['gameID']]['pickID'] == $visitorTeam->teamID) ? ' checked="checked"' : '') . ' /> <label for="' . $result['gameID'] . $visitorTeam->teamID . '">' . $visitorTeam->teamName . '</label><br />' . "\n";
			echo '			<input type="radio" name="game' . $result['gameID'] . '" value="' . $homeTeam->teamID . '" id="' . $result['gameID'] . $homeTeam->teamID . '"' . (( $picks[$result['gameID']]['pickID'] == $homeTeam->teamID) ? ' checked="checked"' : '') . ' /> <label for="' . $result['gameID'] . $homeTeam->teamID . '">' . $homeTeam->teamName . '</label><br />' . "\n";
            echo '			<input type="text" min="1" max="15" length="2" name="points' . $result['gameID'] . '" value="' . $picks[$result['gameID']]['points']  . '"/><br />' . "\n";				
			
		} else {
			//else show locked pick
			$pickID = getPickID($result['gameID'], $user->userID);
			if (!empty($pickID)) {
				$statusImg = '';
				$pickTeam = new team($pickID);
				$pickLabel = $pickTeam->teamName;
                          
			} else {
				$statusImg = '<img src="images/cross_16x16.png" width="16" height="16" alt="" />';
				$pickLabel = 'None Selected';
			}
			if ($scoreEntered) {
				//set status of pick (correct, incorrect)
				if ($pickID == $result['winnerID']) {
					$statusImg = '<img src="images/check_16x16.png" width="16" height="16" alt="" />';
				} else {
					$statusImg = '<img src="images/cross_16x16.png" width="16" height="16" alt="" />';
				}
			}
			echo '			' . $statusImg . ' ' . $pickLabel . "\n";
		}
		echo '			</td>' . "\n";
		echo '		</tr>' . "\n";
		$i++;
	}
	echo '</table>' . "\n";
	echo '<p><input type="checkbox" name="showPicks" id="showPicks" value="1"' . (($showPicks) ? ' checked="checked"' : '') . ' /> <label for="showPicks">Allow others to see my picks</label></p>' . "\n";
	echo '<p><input type="submit" name="action" value="Submit" /></p>' . "\n";
	echo '</form>' . "\n";
}
?>
<?php include('includes/footer.php'); ?>[/php]
I tried echoing the variables but it redirects to results.php like instantly, even when I removed the Header redirect line.

Did you put the exit; after the echo?

I’ve got 2 exits in there and it ain’t quiting

[php] $pts = (int)$_POST[’$pts’];
$sql = "insert into " . $db_prefix . “picks (userID, gameID, pickID, points) values (” . $user->userID . ", " . $result[‘gameID’] . ", " . $_POST[‘game’ . $result[‘gameID’]] . ", " . $pts . “);”;

      echo (int)$_POST['points' . $result['gameID']];

exit;
mysql_query($sql) or die('Error inserting pick: ’ . mysql_error());
echo $sql;
exit;

	}
}
        
        header('Location: results.php?week=' . $_POST['week']);

[/php]

Then it’s not hitting that code… Put the exits way up and see if it quits

If I put them anywhere inside the if action submit it does not die, but it does write the values to the database.

If I put it before that if statement, it exits.

If I totally remove the header(‘Location: results.php?week=’ . $_POST[‘week’]);

it still ends up in results.php, where could it be redirecting from

You should always have and exit; after a redirect. Because the code will continue executing even through you are redirecting it.

[php]header(‘Location: results.php?week=’ . $_POST[‘week’]);
exit;[/php]

OK, added that exit, now have exits all over the place, and it is still writing to the database yet not hitting those exits. Lines 15 , 36, 38 even through a sleep in at 25. How does it update the pick in the table but not hit any of those exits?

And how does it still redirect when I remove the Header line?

I’m doing this for a non-profit I belong to and it is driving me nuts, aaaarggh :’(

[php]<?php
require_once(‘includes/application_top.php’);
require(‘includes/classes/team.php’);

if ($_POST[‘action’] == ‘Submit’) {

$week = $_POST['week'];
$cutoffDateTime = getCutoffDateTime($week);

//update summary table
$sql = "delete from " . $db_prefix . "picksummary where weekNum = " . $_POST['week'] . " and userID = " . $user->userID . ";";
mysql_query($sql) or die('Error updating picks summary: ' . mysql_error());
$sql = "insert into " . $db_prefix . "picksummary (weekNum, userID, showPicks) values (" . $_POST['week'] . ", " . $user->userID . ", " . (int)$_POST['showPicks'] . ");";

echo $sql;
exit;

mysql_query($sql) or die('Error updating picks summary: ' . mysql_error());


//loop through non-expire weeks and update picks
$sql = "select * from " . $db_prefix . "schedule where weekNum = " . $_POST['week'] . " and (DATE_ADD(NOW(), INTERVAL " . SERVER_TIMEZONE_OFFSET . " HOUR) < gameTimeEastern and DATE_ADD(NOW(), INTERVAL " . SERVER_TIMEZONE_OFFSET . " HOUR) < '" . $cutoffDateTime . "');";
$query = mysql_query($sql);

sleep(25);
while ($result = mysql_fetch_array($query)) {
$sql = "delete from " . $db_prefix . "picks where userID = " . $user->userID . " and gameID = " . $result[‘gameID’];
mysql_query($sql) or die('Error deleting picks: ’ . mysql_error());

	if (!empty($_POST['game' . $result['gameID']])) {
               $pts = trim('points' . $result['gameID']);
		$pts = (int)$_POST['$pts'];
		$sql = "insert into " . $db_prefix . "picks (userID, gameID, pickID, points) values (" . $user->userID . ", " . $result['gameID'] . ", " . $_POST['game' . $result['gameID']] . ", " . $pts . ");";

      echo (int)$_POST['points' . $result['gameID']];

exit;
mysql_query($sql) or die('Error inserting pick: ’ . mysql_error());
echo $sql;
exit;

	}
}
        
        header('Location: results.php?week=' . $_POST['week']);
        exit;

} else {
$week = (int)$_GET[‘week’];
if (empty($week)) {
//get current week
$week = (int)getCurrentWeek();
}
$cutoffDateTime = getCutoffDateTime($week);
$firstGameTime = getFirstGameTime($week);
}

include(‘includes/header.php’);
include(‘includes/column_right.php’);

//display week nav
$sql = "select distinct weekNum from " . $db_prefix . “schedule order by weekNum;”;
$query = mysql_query($sql);
$weekNav = '

Go to week: ';
$i = 0;
while ($result = mysql_fetch_array($query)) {
if ($i > 0) $weekNav .= ’ | ';
if ($week !== (int)$result[‘weekNum’]) {
$weekNav .= ‘’ . $result[‘weekNum’] . ‘’;
} else {
$weekNav .= $result[‘weekNum’];
}
$i++;
}
$weekNav .= ‘
’ . “\n”;
echo $weekNav;
?>
			<h2>Week <?php echo $week; ?> - Make Your Picks:</h2>
			<p>Make your picks below by clicking on the team helmet or checking the radio buttons to the right.</p>
			<script type="text/javascript">
			function checkform() {
				//make sure all picks have a checked value
				var f = document.entryForm;
				var allChecked = true;
				var allR = document.getElementsByTagName('input');
				for (var i=0; i < allR.length; i++) {
					if(allR[i].type == 'radio') {
						if (!radioIsChecked(allR[i].name)) {
							allChecked = false;
						}
					}      
			    }
			    if (!allChecked) {
					return confirm('One or more picks are missing for the current week.  Do you wish to submit anyway?');
				}
				return true;
			}
			function radioIsChecked(elmName) {
				var elements = document.getElementsByName(elmName);
				for (var i = 0; i < elements.length; i++) {
					if (elements[i].checked) {
						return true;
					}
				}
				return false;
			}
			</script>
<div style="float: right; width: 270px; margin-right: 10px"><?php include('includes/comments.php'); ?></div>
<?php
//get existing picks
$picks = getUserPicks($week, $user->userID);
$points = array();
$points = $picks;

//get show picks status
$sql = "select * from " . $db_prefix . "picksummary where weekNum = " . $week . " and userID = " . $user->userID . ";";
$query = mysql_query($sql);
if (mysql_num_rows($query) > 0) {
	$result = mysql_fetch_array($query);
	$showPicks = (int)$result['showPicks'];
} else {
	$showPicks = 1;
}

//display schedule for week
$sql = "select s.*, (DATE_ADD(NOW(), INTERVAL " . SERVER_TIMEZONE_OFFSET . " HOUR) > gameTimeEastern or DATE_ADD(NOW(), INTERVAL " . SERVER_TIMEZONE_OFFSET . " HOUR) > '" . $cutoffDateTime . "')  as expired ";
$sql .= "from " . $db_prefix . "schedule s ";
$sql .= "inner join " . $db_prefix . "teams ht on s.homeID = ht.teamID ";
$sql .= "inner join " . $db_prefix . "teams vt on s.visitorID = vt.teamID ";
$sql .= "where s.weekNum = " . $week . " ";
$sql .= "order by s.gameTimeEastern, s.gameID";
//echo $sql;
$query = mysql_query($sql);
if (mysql_num_rows($query) > 0) {
	echo '<form name="entryForm" action="entry_form.php" method="post" onsubmit="return checkform();">' . "\n";
	echo '<input type="hidden" name="week" value="' . $week . '" />' . "\n";
	echo '<table cellpadding="4" cellspacing="0" class="table1">' . "\n";
	//echo '	<tr><th>Home</th><th>Visitor</th><th align="left">Game</th><th>Time / Result</th><th>Your Pick</th></tr>' . "\n";
	$i = 0;
	while ($result = mysql_fetch_array($query)) {
		$homeTeam = new team($result['homeID']);
		$visitorTeam = new team($result['visitorID']);
		$rowclass = (($i % 2 == 0) ? ' class="altrow"' : '');
		//$pickExpired = ((date("U") > strtotime($result['gameTimeEastern'])) ? true : false);
		echo '		<tr' . $rowclass . '>' . "\n";
		echo '			<td align="center">' . "\n";
		echo '				<table width="100%" border="0" cellpadding="2" cellspacing="0" class="nostyle">' . "\n";
		echo '					<tr valign="middle">' . "\n";
		echo '						<td align="center"><label for="' . $result['gameID'] . $visitorTeam->teamID . '"><img src="images/helmets_big/' . strtolower($visitorTeam->teamID) . '1.gif" onclick="document.entryForm.game' . $result['gameID'] . '[0].checked=true;" /></label><br /><span style="font-size: 9px;"><b>' . $visitorTeam->city . ' ' . $visitorTeam->team . '</b><br />Record: ' . getTeamRecord($visitorTeam->teamID) . '<br />Streak: ' . getTeamStreak($visitorTeam->teamID) . '</span></td>' . "\n";
		echo '						<td align="center">at</td>' . "\n";
		echo '						<td align="center"><label for="' . $result['gameID'] . $homeTeam->teamID . '"><img src="images/helmets_big/' . strtolower($homeTeam->teamID) . '2.gif" onclick="document.entryForm.game' . $result['gameID'] . '[1].checked=true;" /></label><br /><span style="font-size: 9px;"><b>' . $homeTeam->city . ' ' . $homeTeam->team . '</b><br />Record: ' . getTeamRecord($homeTeam->teamID) . '<br />Streak: ' . getTeamStreak($homeTeam->teamID) . '</span></td>' . "\n";
		echo '					</tr>' . "\n";
		if (strlen($result['homeScore']) > 0 && strlen($result['visitorScore']) > 0) {
			//if score is entered, show score
			echo '					<tr><td colspan="3" align="center"><b>Final: ' . $result['visitorScore'] . ' - ' . $result['homeScore'] . '</b></td></tr>' . "\n";
		} else {
			//else show time of game
			echo '					<tr><td colspan="3" align="center">' . date('D n/j g:i a', strtotime($result['gameTimeEastern'])) . ' ET</td></tr>' . "\n";
		}
		echo '				</table>' . "\n";
		echo '			</td>' . "\n";
		echo '			<td align="left"><b>Your Pick:</b><br />' . "\n";
		if (!$result['expired']) {
			//if game is not expired, show pick
			echo '			<input type="radio" name="game' . $result['gameID'] . '" value="' . $visitorTeam->teamID . '" id="' . $result['gameID'] . $visitorTeam->teamID . '"' . (($picks[$result['gameID']]['pickID'] == $visitorTeam->teamID) ? ' checked="checked"' : '') . ' /> <label for="' . $result['gameID'] . $visitorTeam->teamID . '">' . $visitorTeam->teamName . '</label><br />' . "\n";
			echo '			<input type="radio" name="game' . $result['gameID'] . '" value="' . $homeTeam->teamID . '" id="' . $result['gameID'] . $homeTeam->teamID . '"' . (( $picks[$result['gameID']]['pickID'] == $homeTeam->teamID) ? ' checked="checked"' : '') . ' /> <label for="' . $result['gameID'] . $homeTeam->teamID . '">' . $homeTeam->teamName . '</label><br />' . "\n";
            echo '			<input type="text" min="1" max="15" length="2" name="points' . $result['gameID'] . '" value="' . $picks[$result['gameID']]['points']  . '"/><br />' . "\n";				
			
		} else {
			//else show locked pick
			$pickID = getPickID($result['gameID'], $user->userID);
			if (!empty($pickID)) {
				$statusImg = '';
				$pickTeam = new team($pickID);
				$pickLabel = $pickTeam->teamName;
                          
			} else {
				$statusImg = '<img src="images/cross_16x16.png" width="16" height="16" alt="" />';
				$pickLabel = 'None Selected';
			}
			if ($scoreEntered) {
				//set status of pick (correct, incorrect)
				if ($pickID == $result['winnerID']) {
					$statusImg = '<img src="images/check_16x16.png" width="16" height="16" alt="" />';
				} else {
					$statusImg = '<img src="images/cross_16x16.png" width="16" height="16" alt="" />';
				}
			}
			echo '			' . $statusImg . ' ' . $pickLabel . "\n";
		}
		echo '			</td>' . "\n";
		echo '		</tr>' . "\n";
		$i++;
	}
	echo '</table>' . "\n";
	echo '<p><input type="checkbox" name="showPicks" id="showPicks" value="1"' . (($showPicks) ? ' checked="checked"' : '') . ' /> <label for="showPicks">Allow others to see my picks</label></p>' . "\n";
	echo '<p><input type="submit" name="action" value="Submit" /></p>' . "\n";
	echo '</form>' . "\n";
}
?>
<?php include('includes/footer.php'); ?>[/php]

This may sound silly, but maybe you’re not running on the code you’re changing?

No, because if I move the exit to right underneath the top 2 require statements it does die, too funny, I have done that before though.

Keep moving the exit down slowly and see where it stops working… Also do you have debugging turned on?

Once I move the exit inside that 1st if condition it is like it doesn’t exist. Yet it updates that table (with the exception of the points field). I have been going through the required files, functions, java, and am trying to see how else it can be updating the table and forwarding to results.php without hitting those exit statements.

How do I turn the debug on? Forgive me I am green.

http://php.net/manual/en/function.error-reporting.php

Basically Add this to the top of your php file.

[php]// Report all PHP errors
error_reporting(-1);
[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service