I have baseball player's contracts listed in a big database. The years of their contract are listed in under columns entitled "contract_byr1," "contract_byr2," (etc) all the way up to "contract_byr10." Also, there's another column called "contract_length."
Now, I call to the SQL database using...
$conRow = mysql_fetch_array($getContract); $totalYears = $conRow['contract_years'];
Now, once it comes time to display the salary, I have a for loop set up like this:
for($displayYear = '1'; $displayYear <= $totalYears; $currentYear++)
OK, I tried using this code within the aforementioned loop:
print "Year $displayYear salary: " $curConYear = "contract_byr$currentYear"; $tempSalary = $conRow['$curConYear']; print $tempSalary;
Unfortunately, it doesn't return any value... so clearly something in the above code listing is wrong! I'm 99% sure the "$conRow['$curConYear']" method doesn't work, so what alternatives do I have?
When it outputs, it basically looks like this:
Year 1: (nothing)
Year 2: (nothing)
Thanks, your support is much appreciated!