MySql: Add information into multiple tables with one command -
i using php , mysql. want insert multiple tables 1 command. can done stored procedure or function? if so, call function php?
eg (psuedo code, don't code in mysql often):
hash %list = {"ip", "network_table"; "gateway", "network_table"; "name", "server_table"); function lookup (string $s) { //look value of s in hash , return corresponding table $table = $list[s] return $table; } function dotheinserting (hash $input) //or hash_ref? or array? { each $key in $input{ $table = &lookup $key insert $table ($key) values ($value) } }
some problems arise if have multiple "not null" columns. viable way? there better way if need go entering information multiple tables @ once?
Comments
Post a Comment