hello guys...i have a class table in which there are two fields class_id and class_name and a student form in which there is a text field in which user will mention the student class and then hit add.this will retrieve class_id from class table instead of class name into student table.i want to retrieve the id of specfic field from one table and put it in the other table...is this possible with mysql queries to retrieve specfic id of the field from one table and input it into anonther table.if so please let me known.hope you understand my explaintion of my problem

You mean like:

insert student(classId) 
 select classId from class where...

like

INSERT INTO FIELD_NAME FROM TABLE_NAME SELECT FIELD_ID FROM TABLE_NAME WHERE...

where part before select will be one table and part after select will be another table.are you getting my point

Yeah, I think that's what my example does.

I may have left off an "into". Student and Class are tables in this example.

INSERT into student(classId)
    SELECT classId FROM class WHERE...

i will try and then will post the result here

thanks for the help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.