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 Link to comment https://forums.phpfreaks.com/topic/228420-store-query-strings-in-mysql-database/ 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()); Link to comment https://forums.phpfreaks.com/topic/228420-store-query-strings-in-mysql-database/#findComment-1177799 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.