Two questions:
- My table has three fields:
id
,parent_id
,name
. Initiallyid
is0
, for an element that is a child to the current element, theparent_id
is set to theid
of the current element....basically, infinite nesting concept. Now I need to find those elements which do not have any children or sub-elements. Any ideas? - What is the best choice to retrieve the
id
(auto_increment) of a record I just inserted? mysql_insert_id or last_insert_id, or something else? I need to insert two records simultaneously and use the id(primary key) from the first record as foreign key of second record.