This topic is locked

Merging two tables

11/20/2012 4:59:05 PM
PHPRunner General questions
C
cjsaputo author

I have a current records table and a history table. I want to copy all the records from current to history. I have created a button with the following code.
INSERT INTO entrieshistory

SELECT * FROM entries;
Nothing happens when I click the button.

Sergey Kornilov admin 11/21/2012

What your exact code? In buttons you need to use either Javascript or PHP code. This is SQL Query.

C
cjsaputo author 11/23/2012



What your exact code? In buttons you need to use either Javascript or PHP code. This is SQL Query.


That SQL query is the exact code stored in the button. What I need then is the PHP code to copy all of the records from table 1 to table 2. I want to copy all of the records and all of the fields from Table 1 to table 2.
Table 1 key is a field named paradeseq but I don't need that field in table 2. The table 2 key is a field named key. It is set to autoincrement.

Sergey Kornilov admin 11/23/2012

Here are examples of executing a SQL Query from PHP code:

http://xlinesoft.com/phprunner/docs/customquery.htm