I have two arrays used to populate cells in a table
The first array is fixed:
$pointsArray = array(
1 => 500,
2 => 350,
3 => 250,
4 => 200,
5 => 150,
6 => 100,
7 => 75,
8 => 50,
);
To use the data from the First array in the table I have:
echo $points = isset($pointsArray[$counter]) ? $pointsArray[$counter] : 25; ;
This put the correct number of points in the points colunm depending on the finishing position of the player.
The Second array is filled from mysql and therefore can change
function QueryIntoArray($queryA){
settype($retval,"array");
$resultA= mysql_query($queryA);
if(!$resultA){
print "Query Failed";
}
for($i=0;$i<mysql_numrows($resultA);$i++){
for($j=0;$j<mysql_num_fields($resultA);$j++){
$retval[$i][mysql_field_name($resultA,$j)] = mysql_result
($resultA,$i,mysql_field_name($resultA,$j));
}//end inner loop
}//end outer loop
return $retval;
}
The second array works and I can print a list of all the information held in it using:
<?php
OpenDb($hostname,$uid,$pwd,$dbname) or die("Failed Opening Database");
settype($myresultA,"array");
$queryA = "SELECT * FROM Player";
$myresultA = QueryIntoArray($queryA);
for($i=0;$i<count($myresultA);$i++){
print $myresultA[$i]["MembershipNo"];
print $myresultA[$i]["FirstName"];
print $myresultA[$i]["NickName"];
print $myresultA[$i]["LastName"];
}
?>
Now is the bit I'm stuck on!!
I want to populate the FirstName column with the data held in the second array, but based on the membership number entered in the MembershipNo column by the user.
I know this can be done using onkeyup but I just don't know how!!
Can anyone help me work it out please?