your using sessions and user logins?
when the user logged in, save the USERID into a $_SESSION["uid"],
then on insert, use that in the SQL statement, like:
$sql="insert into table (`user_id`,`a`,`b`,`c`) VALUES ('{$_SESSION["uid"]}', '{$_POST["a"]}','{$_POST["b"]}','{$_POST["c"]}')";
In queries username field could not identify your user, that's why you inserted a primary key.
When you select the items then use the JOIN statement between the two tables.
If this is a register page,
INSERT INTO foo (auto,username)
VALUES(NULL,'username');
INSERT INTO foo2 (foo_id,text)
VALUES(LAST_INSERT_ID(),'text for the inserted item');
But this not always works. You need check if the isert success, then go to the next step.