> Date: Mon, 20 Apr 2009 13:03:14 +0100 > From: andy-li...@networkmail.eu > To: defati...@hotmail.com > CC: mysql@lists.mysql.com > Subject: Re: Need help with mysql prob > > Hi Alugo, > > abdulazeez alugo wrote: > > > > Hi Andy, > > Thank you very much you have been really very helpful. All those > > mistakes you pointed at in the script about the apostrophe and others, > > are simple mistakes I just made in the rush of typing the message; and > > yes $conn is the result from mysql_connect. In my original script I > > clean my script to avoid mysql injection. > > No worries, just thought I'd point it out in case ;-) > > > However, if you look at the code very well, you'll realize that I have > > stored the result of the mysql_insert-id($conn) in a php variable > > $tbl1_id and this is defined within a function *newPost_tbl1($id, > > $entry, $text).* My problem now is how to access that variable in the > > function that inserts into the child table so that I'll have the same > > value for tbl1_id in tbl1 and tbl1_id in tbl2. > > Why not just return it from the function? > > .... > $tbl1_id = mysql_insert_id(); > return $tbl1_id; > .... > > Then in the code that calls newPost_tbl1 ... > > $tbl1_id = newPost_tbl1($id, $entry, $text); > newPost_tbl2($tbl1_id, ....); > > Regards, > Andy > Thank you very much Andy,
Now my problem is solved. Cheers. Alugo Abdulazeez. _________________________________________________________________ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us