fury shot
12 years ago
karma ok i've been busy with things inc pokémon
latest #33
the feℓsider.
12 years ago
YOU I need to chat with you about sql security/methods sometime... soon
fury shot
12 years ago
are you getting errors
the feℓsider.
12 years ago
no I'm unsure about how to implement something I currently do manually through a form. it involves dumping data from one table to another, amending the id numbers for continuity (so the table that's being
立即下載
the feℓsider.
12 years ago
dumped continues from the number it finished with) and then emptying the table
the feℓsider.
12 years ago
well I say form, I mean button
the feℓsider.
12 years ago
I want someone to be able to do it without manually typing all the SQL
fury shot
12 years ago
you mean you have like
fury shot
12 years ago
table A with 50 records
fury shot
12 years ago
and you make table B and you want the 50 records from table A to be put in table B
fury shot
12 years ago
then empty table A OR
fury shot
12 years ago
do you already have table B with like 200 records
fury shot
12 years ago
and you want records 201-250 to be the stuff in table A
the feℓsider.
12 years ago
both of these things...
fury shot
12 years ago
no they're contradictory things
fury shot
12 years ago
either table B already exists or it doesn't
fury shot
12 years ago
what exactly is it you need to do
fury shot
12 years ago
as far as I can understand you have a table A that has a number of records, say 1-30
fury shot
12 years ago
and you have a table B which can have any number of records
fury shot
12 years ago
and you want to tack the records in table A at the end of table B
fury shot
12 years ago
and then clear table A
fury shot
12 years ago
if that is what you need to do you just need to grab data from A and insert into B with a loop, and ignore any IDs in A since when you insert into B, it'll automatically apply IDs that follow B's order
fury shot
12 years ago
if you have AUTO_INCREMENT on table B set to on
fury shot
12 years ago
so if A has 50 records and B has 0 records you'll get IDs 1-50 in B
fury shot
12 years ago
and if A has 50 records and B has 200 records you'll get IDs 201-250 in B
fury shot
12 years ago
just ignore the IDs from A, and don't specify an ID when inserting into B, and it'll automatically add the IDs for you
the feℓsider.
12 years ago
okay, excellent, that seems workable. do I need to code deleting/emptying the line into the loop? ie. loop goes "grab data, dump into table B, erase data, repeat until no more datas"?
the feℓsider.
12 years ago
also sorry I misread one of the options you offered but you seem to understand what I am doing, haha...
fury shot
12 years ago
nah you can just empty the entire table at the end there's a command for it
fury shot
12 years ago
i just.. forget what it is
fury shot
12 years ago
ok google knows
fury shot
12 years ago
TRUNCATE TABLE tablename;
fury shot will
12 years ago
do it
the feℓsider.
12 years ago
ahhh okay, thanks!
back to top