...

View Full Version : Resolved insert with select troubles.



bazz
03-20-2010, 02:56 AM
Yay!! I got it with singel quotes. Thought I had previously tried that.

When inserting to an archive table with data selected from a 'live' table, I want also to input to the archived table, the name of the person who did it ~ $admin

I can't seem to work out how to get the $admin var into the insert. I seek your guidance.



INSERT INTO files_archived
( business_id
, content_category
, file_name
, file_text
, live_from
, when_archived
, archived_by
)
SELECT
business_id
, content_category
, file_name
, file_text
, live_from
, CURRENT_TIMESTAMP
, "$admin"
FROM files as f
WHERE f.business_id = ?
AND f.content_category = ?
AND f.file_name = ?
AND f.live_from = ?
and archived_by = ?



If you haven't time can you maybe supply me with a search term?

bazz



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum