Stroring a query in a table

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Stroring a query in a table

Post 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
Last edited by JayBird on Mon Jul 26, 2004 9:30 am, edited 1 time in total.
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

You will most likely have to escape any special characters within the query string prior to including within the insert query.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post 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
Post Reply