Jump to content

Store Query Strings in MySQL Database


cbm3384

Recommended Posts

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

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());

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.