I have a simple test and I wanted to display the score to the user for the test they took. I wrote this script and then tried to echo the result and it didn't work. Does anyone know the correct way to add up numbers in different column in a database and then divide and then print the calculation?
$query = mysql_query("SELECT (questionone + questiontwo + questionthree) as Total FROM sampletest WHERE id = $session[id]");
$score = "$query/3";
then I tried to echo the variable score.
You scored<? echo "$score"; ?>%
It prints out this. Obviously not what I was looking for.
Resource id #3/12
Thanks for your help