From: "Ryan A" <[EMAIL PROTECTED]>

> 2. The query also checks if I have a stored sql statement for this C_ID
> 2a. If "YES" it tries to execute the query (if NO, execution stops here,
all
> is well)
>
> 3.The stored SQL is usually something like "insert into
> tester('$client_id','$client_name')"
>
> Heres where the problems coming in, it seems to be doing everything as it
> should except when
> I check the database I see that it has inserted:
> "$client_id"  "$client_name"  into the fields instead of "12"  "ryan"
>
> The above should explain everything but if you want the code I can post
it.

You have to eval() the code from the database to get the variables replaced
(or use a regex).

<?php
$name = 'John';
$str = file_get_contents('test.txt'); //Reads "Hello $name"
eval('$str = "' . $str . '";');
echo $str;
?>

or

<?php
$name = 'John';
$str = file_get_contents('test.txt'); //Reads "Hello $name"
$str = preg_replace('/\$([a-zA-Z_]\w+)/e','$\1;',$str);
echo $str;
?>

---John Holmes..

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to