php arrays, mysql, and post forms - SOLVED

Hi everyone. What I am trying to do is create a system that ultimately grabs information from a mysql table and allow me to update it.

Currently, I have created a form in a while-loop that sets up the user-interface. I am right now trying to get it to post to a separate page, and from there output only the row that does not have equal fields where the user can input information. This is the beginning step to test to make sure everything is posting correctly.

The 2 web pages are:
http://scilfball.com/submit/scores/submitscore.php
http://scilfball.com/submit/scores/scresults.php

Submit Score code looks like this:
{database info here}

<? $query="SELECT GameID,Date,Away,AwayScore,Home,HomeScore FROM 2008sched WHERE AwayScore IS NULL ORDER BY GameID ASC LIMIT 12"; $result=mysql_query($query) or die(mysql_error()); $num=mysql_numrows($result); ?> <? $i=0;

while ($i < $num) {
$date=mysql_result($result,$i,“date”);
$gameid=mysql_result($result,$i,“GameID”);
$away=mysql_result($result,$i,“away”);
$home=mysql_result($result,$i,“home”);

?>








 <?  $i++; } ?>
GameID Date Away Away Score Home Home Score
<? echo '';?> <? echo '';?> <? echo '';?> <? echo '';?> <? echo '';?> <? echo '';?>

?>

<? mysql_close(); ?>


scresults.php looks like this:

{database info}
$ascore[]=array();
$hscore[]=array();
$dtarray[]=array();
$gidarray[]=array();
$harray[]=array();
$aarray[]=array();

for ($x=0; $x<$num; $x++) {
	$ascore[$x]=($_POST["asc_'.$x.'"]); 
	$hscore[$x]=($_POST["hsc_'.$x.'"]);
	$dtarray[$x]=($_POST["dt_'.$x.'"]); 
	$gidarray[$x]=($_POST["gid_'.$x.'"]);
	$aarray[$x]=($_POST["aw_'.$x.'"]); 
	$harray[$x]=($_POST["hm_'.$x.'"]); 
	
	echo $gidarray[$x].'<br>'.$dtarray[$x].'<br>'.$haarray[$x]." ".$hscore[$x].'<br>'.$aarray[$x]." ".$ascore[$x].'<br><br>';
	}
	
	
for ($y=0; $y<$num; $y++) {
	if ($ascore[$x] == $hscore[$x]) {
		print_r ($gidarray[$x]);
		echo '<br>';
		} 
}

mysql_close(); ?>

My scresults.php shows up blank. If you have any suggestions, I am all ears.

Thanks in advance,
Joe

You’re going to have to give us a little more information. What do you get if you use error_reporting(E_ALL)? See also debugging tips (link in my signature).

Thanks for the reply. After adding the error reporting in, without an echo, it is still a blank window. With an echo, it outputs the numbers ‘20397’.

I figured it out. The $num was not moving to the action page from the original page.

Sponsor our Newsletter | Privacy Policy | Terms of Service