Re: Problem running sql stored in the database

From: Date: Fri, 09 Apr 2004 14:59:10 +0000
Subject: Re: Problem running sql stored in the database
Groups: php.general 
Request: Send a blank email to php-general+get-182986@lists.php.net to get a copy of this message
> 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; > ?> Hi John, That didn't work (eval i dont know regex well enough so dont use them), I visited the online manual for eval and see that we are on the right track but I am screwing up somewhere...(as usual) rather than explain it over and over and confuse everyone, heres the code i am using: * * * * * * code * * * * * * if($sql_exists == 0){} // first checked if there was any sql associated with this else{$cust_qry=stripslashes($o_sql); echo $i2co_order_number; // Testing to see if this variable holds a value, it does. eval('$i2co_order_number = "'.$i2co_order_number.'";'); // even tried putting cust_qry without success $cust_result = mysql_query($cust_qry); if(!$cust_result){echo 'Error (S1) running your optional custom SQL statement.'.mysql_error();} * * * * * * code * * * * * * comments? suggestions? Thanks, -Ryan A

« previous php.general (#182986) next »