I have table contain grade of student i need to convert grade to A+,A,…etc
I try this but not save result in database i need to know where problem
help me please
$asse = mysql_query("SELECT Grade FROM studentgrade") or die("SELECT Error: ".mysql_error());
$STAssessment ;
while($row = mysql_fetch_array($asse))
{
Grade=$row ;
$query2="UPDATE studentgrade if(Grade>=95) { SET Assessment="A+"}
elseif(Grade>=90) { SET Assessment="A"}
elseif(Grade>=85) { SET Assessment="B+"}
elseif(Grade>=80 ) { SET Assessment="B"}
elseif(Grade>=75) { SET Assessment="C+"}
elseif(Grade>=70) ) { SET Assessment="C"}
elseif(Grade>=65) { SET Assessment="D+"}
else(Grade>=60) { SET Assessment="D"}
else { SET Assessment="A"}
endif
WHERE Grade IS NOT NULL ";
$row++;
}
Instead of copypasting an example, maybe you should think what to adjust? The hint is there, it’s easy to read - you should find your way around it without being served everything for your school project
replace the … with the other grade criteria and then either run the query directly in a sql window of your sql gui or run the query in php if it needs to be part of a php application.