Need to Insert then update a field in a table
<p>Need help badly guys,</p>

<p>I have three tables tbl_questions, tbl_answers and tbl_link_qa</p>

<p>tbl_questions is where the questions from students get stored and tbl_answers is where the experts answer should be stored. tbl_link_qa connects the two tables in which the id number from tbl_questions gets stored in tbl_link_qa as q_std_id same idea with the id number from tbl_answers only that instead of insert, it updates if it finds an id number in tbl_link_qa without and expert id</p>

<p>i know this sounds confusing but I really need your help guys, I'm having my defense next week and I NEED to get this</p>

<p>here's my code:</p>

<p>i had to remove my update code since it was clearly not working T_T</p>

<pre><code>$exp_reply = $_REQUEST['expertAnswerTypeBox'];  
$idnumber = $_REQUEST['exp_id'];
$std_question = $_REQUEST['question'];

$q_id = $_REQUEST['std_id'];


$sql2="SELECT * FROM tbl_teacher WHERE exp_id='$idnumber'";
$call_exp = "SELECT * FROM tbl_teacher WHERE exp_id='$idnumber'";

$call_std = "SELECT * FROM tbl_link_qa WHERE q_std_id='$q_id'";

$sql3="SELECT * FROM tbl_questions WHERE question ='$std_quesion'";     
$results = "Insert into tbl_answers(answers,id_exp) values('$exp_reply','$idnumber')";
$insert_a_link = "Insert into tbl_link_qa(a_exp_id) values($idnumber)";
</code></pre>
