MYSQL tutorialThe following is an instance of the MySQL database trigger. To view the trigger details in the MySQL database, you can use the following statement: before using the show triggers statement, you must specify the database to view.
1) Select the database to view the trigger. The Code is as follows:
Reference content is as follows: $ Dbname = $ _ POST [name]; $ conn = mysql_connect ("localhost", "root", "root"); mysql_select_db ($ dbname, $ conn ); mysql_query ("set names gb2312 "); |
2) execute the show triggers statement and display the details of the trigger found. The Code is as follows:
Reference content is as follows: <? Php mailto: $ SQL = @ mysql_query ("show '> $ SQL = @ mysql_query (" show triggers ", $ conn); $ info = @ mysql_fetch_array ($ SQL ); if ($ info = false) {?> <Tr> <td height = "25" colspan = "5" bgcolor = "# FFFFFF"> <div align = "center"> no trigger is set for this database! </Div> </td> </tr> <? Php} else {do {?> <Tr> <td height = "25" bgcolor = "# FFFFFF"> <div align = "center"> <? Php echo $ info [Trigger];?> </Div> </td> <td height = "25" bgcolor = "# FFFFFF"> <div align = "center"> <? Php echo $ info [Table];?> </Div> </td> <td height = "25" bgcolor = "# FFFFFF"> <div align = "center"> <? Php echo $ info [Event];?> </Div> </td> <td height = "25" bgcolor = "# FFFFFF"> <div align = "center"> <? Php echo $ info [Timing];?> </Div> </td> <td height = "25" bgcolor = "# FFFFFF"> <div align = "center"> <? Php echo $ info [Statement];?> </Div> </td> </tr> <? Php} while ($ info = mysql_fetch_array ($ SQL) ;}?> |