Jump to content

why wont the data added to the database.


xxreenaxx1

Recommended Posts

I have a code that works but it wont add the data to my database. It says the data has been added but the actual data is not actually added.

 

I have checked through this code to see any errors but I cant find any. Can someone help me

 

$sqll= takeanexam($_SESSION['username1'], $_SESSION['ssubject'], $_SESSION['smodule']);
  
     // mysql_data_seek(sqll, 0);
  
     while($info = mysql_fetch_array( $sqll )) {
	    $questionId = $info['Que_ID'];
		$choice = array();
        for ($i =1; $i < 5; $i++) {
   
	if (empty($_POST['choice'][$questionId][$i])) {
  
		$choice[$i] = 0;
   
	} else {
  
		$choice[$i] = 1;
  
	}

	}

	$username= $_SESSION['username1'];

       mysql_query("INSERT INTO answer (Ans_Answer1, Ans_Answer2, Ans_Answer3, Ans_Answer4, Que_ID, Use_ID) 
   VALUES ({$choice[1]}, {$choice[2]}, {$choice[3]}, {$choice[4]}, $questionId, $username)");
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.