Jump to content

[SOLVED] Whats wrong in my codes?


cyrixware

Recommended Posts

The problem is that when i click the submit button the page turns blank... maybe thers something wrong in this line

$sql_update = "UPDATE studsubj SET SCourse = '$SuCourse', SCode ='$SCode', SuID = '$SuID', SuGrade  = '$ave' WHERE SCode = '$SCode' AND SuID = '$SuID'";		

Because when i erased this one: WHERE SuID = '$SuID'"; from WHERE SCode = '$SCode' AND SuID = '$SuID'"; it works fine. but the problem is i need to bind or use the SuID and SuCourse togethere...

 

<?php
$sql_update = "UPDATE studsubj SET SCourse = '$SuCourse', SCode ='$SCode', SuID = '$SuID', SuGrade  = '$ave' WHERE SCode = '$SCode' AND SuID = '$SuID'";				

if(!$q_update = mysql_query($sql_update))
{
die(mysql_error()); 
}
elseif(mysql_affected_rows() == 0)
{
die(mysql_error()); 
}
else
{
?>
<script language="JavaScript">
	alert("Correct Answers = <?=$CorrectAns;?> out of <?=$tItems;?> Average = <?=$ave;?>%.");	
	win = window.open('topicareaStudent.php?ID=<?=$session_id;?>&SuID=<?=$SuID;?>&SuCourse=<?=$SuCourse;?>','_self');
</script>
<?php
}			 
?>

Link to comment
https://forums.phpfreaks.com/topic/100801-solved-whats-wrong-in-my-codes/
Share on other sites

<?php
$sql_update = "UPDATE studsubj SET SCourse = '$SuCourse', 
										SCode ='$SCode', 
										SuID = '$SuID', 
										SuGrade  = '$ave' 
				WHERE SCode = '$SCode' AND SuID = '$SuID'";		

$q_update= mysql_query($sql_update); mysql_error();	

?>

 

Got it i change my query like this one... hehehe :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.