I have this CREATE statement that if I run it in PHPmyAdmin it works fine, which is to say, it picks our the records and inserts them back in the main table via temporary tables. I need to know how to reproduce this functionality in a PHP statement, or at least how to port it over to PHP and get it to perform the same function when the page loads? Here's my statement:
CREATE TEMPORARY TABLE tmp SELECT * from TableA WHERE ColumnA = 'some_word';
ALTER TABLE tmp drop ID; # drop autoincrement field
UPDATE tmp SET ColumnA = CONCAT('copy_',ColumnA);
INSERT INTO TableA SELECT 0,tmp.* FROM tmp;
DROP TABLE tmp;
Ultimately, I'll want to have a table pass a value dynamically to 'some_word', so I can choose from a checkbox next to a field name value, and click the Submit and have the page effectively clone that record, appending the text in ColumnA.
Clear as mud?