RE: [PHP-DB] Storing code in a mysql database

From: Date: Wed, 19 Sep 2001 21:34:04 +0000
Subject: RE: [PHP-DB] Storing code in a mysql database
Groups: php.db 
Request: Send a blank email to php-db+get-12611@lists.php.net to get a copy of this message
I've now progressed to the point where I'm not getting eval errors. The next problem is that is doesn't substitute the variable names: so the code $company_code=1; eval($sql='select * from vehicle where company=$company_code';"); ends up $sql equal to 'select * from vehicle where company=$company_code' and not 'select * from vehicle where company=1' Any clues? TIA Mark > -----Original Message----- > From: Mark Newnham [mailto:mnewnham@adacorp.com] > Sent: Wednesday, September 19, 2001 2:54 PM > To: 'php-db@lists.php.net' > Subject: [PHP-DB] Storing code in a mysql database > > > I'm trying to store SQL code in a blob field in a mysql > database, but i'm > having a problem. > > The code looks like this "$sql='select * from vehicle where > company=$company_code';"; > > After I retrieve it from the db i eval() it to get the result. > > I can make this work if i store the code in a variable, but > not if i store > it in a database table and retrieve it. I am sure i am > missing the right > combination of addslashes/striplashes etc. > > can anyone help on this problem? > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net >

« previous php.db (#12611) next »