I’m creating a game in actionscript that requires the use of an external database to store user details and scores.
This database will contain multiple tables, currently there are two.
My first table contains the headers – ID, email, username, password.
My second table contains the headers – ID, lvl1Score, lvl2Score, lvl3Score.
In my game, when a new user is created it creates an entry in the first table with the ID auto-incrementing.
My question is – Is there anyway to automatically create an entry in my second table with its default values and the same ID when I add to my first table?
I’ve read about joins, but everything i’ve read just talks about looking up data over multiple tables.
Also, is my table structure correct in the sence that the ID value can be used using the JOIN keywork to look up an entry from both tables.
I would suggest you to go for triggers.
create or replace trigger trigger_name after
insert on table1
for each row
begin
insert into table2 values(new.id,”value for lvl2score”,”value for lvl3score”);
end
Something like this.