mysql - Need an alternate Solution--instead of calling php code from a trigger -
i having 2 table consider table1 , table2...
i need trigger after inserting table1.. trigger has thing like
retrieving data 2 other tables using select query(it retrieves more 1 row) calculations data retrieved , need insert table2 single row.. think not possible these in trigger ..so decided call php file trigger things.. persons says calling php trigger not practically , has security risk..
i need suggestion question...please don't down vote or neglect..if question unclear ask me edit...
a simple example out.
$sql="insert `table1` (firstname, lastname, age) values ('$firstname', '$lastname', '$age')"; $result = mysql_query($sql) ; if($result) { // record inserted , place code needs executed after successful insertion } else { // insertion failed }
i assume using mysqli , not mysql becuase mysql_query
deprecated of php 5.5.0 example understand logic.
Comments
Post a Comment