how do i create a trigger to display the columns of the record after it is inserted into the table.
how do integrate php and mysql to do so?

Recommended Answers

All 7 Replies

how do i create a trigger to display the columns of the record after it is inserted into the table.

Can you explain what you want? A trigger is for modifying data, not for displaying.

i need to display the contents of the record EVERYTIME a new record is inserted into a table.
how do i go about it?

MySQL cannot trigger PHP when there is an insert/update. You would need to use a polling mechanism from PHP, query for changes every N seconds/minutes (assuming adding and viewing are two separate disconnected entities).

i am completely new to mysql/php.
could you please elaborate on how i should do that?

Clarify in more detail what you have in mind. How you think it should work. It's hard to guess with so little info.

ok this is my problem description:
in my database i have a table named student. everytime an insert/update/delete is performed on student, the old values, the action performed(i.e inssert/update/delte), time&date of change is stored in another table student_history.
now what i am asked to do is, create an "echo" statement using php, to display columnA and columnB of the record inserted into student_history. i.e everytime an insert is performed on student_history, a new page should open up indicating the value of columnA and columnB of the inserted record. and if 10 records are inserted simultaneously, 10 windows should open, indicating the inserted record

Echoing in PHP is easy, but opening a new page is something PHP cannot do. You probably need some Javascript and AJAX.

This is no longer a simple MySQL question, I'll move this thread to Web Development.

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.