How would I do this (the part in square brackets):
$name = 'Bob';
mysql_query("INSERT INTO table(field1,field2)
[ select value of field1 from another table ], '$name'");
How would I do this (the part in square brackets):
$name = 'Bob';
mysql_query("INSERT INTO table(field1,field2)
[ select value of field1 from another table ], '$name'");
The SQL part of it might look like this:
INSERT INTO table1 (field1, field2) SELECT field1, 'Bob' FROM table2 WHERE ...
Dynamically constructing that in PHP is a simple exercise I leave up to the reader :)