I have a table, table_a, in my MySQL db. (I am using PHP for scripting)
Now I have created another table, after realizing its necessity, called table_b. For every row in table_a I want to insert some of its values into table_b, and then affix a timestamp (DATETIME type).
This is where I am:
$query = "INSERT INTO table_b('id_a', 'type_a', 'date_a') SELECT table_a.id, table_a.type, '$datetime'";
where $datetime is a time value (php).
I'm not sure this is going to work. Could someone tell me a correct way to do this.
(Aside: I am aware I'm not using prepared statements - that's for another day)
Thanks in advance.