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

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to