I have fired the query
mysql_query(
insert into temp_data
(test_id,subject,unit,ques,options,right_opt,marks)
select test_id,subject,unit,ques,options,right_opt,marks
from questions where test_id='$test_id');
but there is one more column stu_id
in temp_data table
whose value is stored in $stu_id
variable.
My problem is i want to insert the stu_id column value as $stu_id and remaining column values from the another table as shown in query
i am not sure what you are trying to do can you b more specific with the question? if you are trying to insert certain rows from one table to another, there are certain things you can do: 1) if you are trying to insert the same values while inserting you can create a trigger in the database and insert only the wanted rows to the next table when insert in 1st table is done 2)you can just dump the data and run the dumped data to another table