cbm3384 Posted February 21, 2011 Share Posted February 21, 2011 I am building a project that requires I store query strings in a table (stage_reqs) which are called to determine permissions. These strings will look something like this: select salesman from jobs where salesman is not NULL and job_id='".$this->job_id."' limit 1 The variable value needs to be determined from within the function it is being accessed in. Can I use eval to do this? Thanks, Chris Quote Link to comment Share on other sites More sharing options...
cbm3384 Posted February 21, 2011 Author Share Posted February 21, 2011 I figured it out. I stored the query string in the database: select salesman from jobs where salesman is not NULL and job_id='".$this->job_id."' limit 1 I retrieved and eval'd it: eval("\$query = \"$query\";"); I executed it: $res = mysql_query($query)or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.