[PHP-DB] Using actual variable values after retreiving from db

2002-01-31 Thread Matthew Walden

Hi,

I used to store SQL code for a transaction 
directly in the PHP script which used it.  It was 
stored as a string.  However, now I want to store 
it in the database and assign it to the same 
string that held it before.  Not very clear, so 
heres an example :

Before:

$sql_variable = select whatever from table;

Now:

$sql_variable = getSQL(whatever);

However, because the SQL contains variables which 
were filled at run time, it does not parse the 
variables when it assigns the string to the 
variable name.  So I get errors because when the 
SQL runs on the database it runs as :

select * from $table_name, 

rather than

select * from whatever

Hope I have explained this OK.  Are there any 
solutions?  For example, force it to parse a 
string for variables and assign their values 
again?

Thanks in advance

Matt

-
This mail sent through UK Online webmail

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Using actual variable values after retreiving from db

2002-01-31 Thread Shooter

would unset() help @ all ? 

as in unset($thevariables) or do u need the variables ? 

Neil
- Original Message - 
From: Matthew Walden [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, January 31, 2002 10:34 PM
Subject: [PHP-DB] Using actual variable values after retreiving from db


 Hi,
 
 I used to store SQL code for a transaction 
 directly in the PHP script which used it.  It was 
 stored as a string.  However, now I want to store 
 it in the database and assign it to the same 
 string that held it before.  Not very clear, so 
 heres an example :
 
 Before:
 
 $sql_variable = select whatever from table;
 
 Now:
 
 $sql_variable = getSQL(whatever);
 
 However, because the SQL contains variables which 
 were filled at run time, it does not parse the 
 variables when it assigns the string to the 
 variable name.  So I get errors because when the 
 SQL runs on the database it runs as :
 
 select * from $table_name, 
 
 rather than
 
 select * from whatever
 
 Hope I have explained this OK.  Are there any 
 solutions?  For example, force it to parse a 
 string for variables and assign their values 
 again?
 
 Thanks in advance
 
 Matt
 
 -
 This mail sent through UK Online webmail
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]