Maths functions
Posted: Tue Mar 17, 2009 8:39 am
Hi guys, this is my code:
but the above code just returns a 0....do i need to use a loop of some sort to get all the differences?
thanks
Code: Select all
$query1="SELECT `Skill_Name`, `Weight`
FROM ID_Table
JOIN Job_ID ON ID_Table.Job_ID = Job_ID.Job_ID
WHERE Job_ID.Job_Name ='$_SESSION[Job_Name]'";
$result1 = mysql_query($query1) or die ("Couldn't execute query.");
while ($row1=mysql_fetch_array($result1))
{
$tblRows1 .= "<tr>";
$tblRows1 .= "<td>{$row1['Skill_Name']}</td>";
$tblRows1 .= "<td>{$row1['Weight']}</td>";
$tblRows1 .= "</tr>\n";
}
$query="SELECT `Skill_Name`, `Score`
FROM Person_Skill
JOIN Person_ID ON Person_Skill.Person_ID = Person_ID.Person_ID
WHERE Person_ID.Person_Name ='$_SESSION[Person_Name]'";
$result = mysql_query($query) or die ("Couldn't execute query.");
while ($row=mysql_fetch_array($result))
{
$tblRows .= "<tr>";
$tblRows .= "<td>{$row['Skill_Name']}</td>";
$tblRows .= "<td>{$row['Score']}</td>";
$tblRows .= "</tr>\n";
}
$diff=($tblRows - $tblRows1);
echo "$diff";
?>thanks