Page 1 of 1

Stroring a query in a table

Posted: Mon Jul 26, 2004 9:18 am
by JayBird
I have this query

Code: Select all

$query = INSERT INTO some_table ('some_info');
I want to put this query into a table and i thought i would be able to do

Code: Select all

INSERT INTO another_table ('$query');
...but it doesn't work.

Any ideas

Mark

Posted: Mon Jul 26, 2004 9:21 am
by redmonkey
You will most likely have to escape any special characters within the query string prior to including within the insert query.

Posted: Mon Jul 26, 2004 9:24 am
by JayBird
God i am stupid, i hadn't even written my insert query correctly.

This

Code: Select all

INSERT INTO another_table ('$query');
should have been..

Code: Select all

INSERT INTO another_table (column_name) VALUES ('$query');
DOH!!!!!

Mark