I have this query where it copies the existing rows:
I need to set another column themeid
as $new_theme_id
value. How do I add that to this query?
$existing_theme_id = 1234;
$new_theme_id = 5678;
$query = "INSERT INTO theme_styles SELECT selector, property, value, '$new_theme_id' AS themeid FROM theme_styles WHERE themeid=?";
try { $stmt = $dbh->prepare($query); $stmt->execute(array($theme_id)); } catch(PDOException $ex) { echo 'Query failed: ' . $e->getMessage(); exit; }
This query doesn't work.
My table structure:
id int(6) AUTO_INCREMENT
themeid int(4)
selector varchar(100) latin1_swedish_ci
property varchar(50) latin1_swedish_ci
value mediumtext latin1_swedish_ci
Please help!