I'm trying to pass a string variable which holds parameters that will be passed to a class (that creates a HTML table) to a function that calls the class. My problem is that string that I'm passing needs to hold several parameters some of which are single quoted others are double quoted. If hard code the parameters into the function and then call my class, it works great - HTML table results with all the options I want. However I've tried passing the parameters in a variable to the function and I cannot get the result to parse correctly. I've tried all combinations of quotes, forward slash, and I've tried some php functions that I've never used before and hance was unsure of how they should be used such as quoted_printable_decode.
Here's the code. The function is called selectData, the variable I'm trying to pass that contains the parameters to input into my class is called $tableOptions.
Body of main program...
$sqloptions = "$appendstr $filterstr $sortstr";
$tableOptions = "\"active\",\"'pass','update','delete','nothing'\"";
selectData($title,$sqloptions,$_POST['status'],$tableOptions);
function selectData($title,$options,$status,$tabOptions)
{
echo "$title";
$table = new buildTable("Select *,
UNIX_TIMESTAMP(date) AS date, UNIX_TIMESTAMP(testdate) AS testdate ,
UNIX_TIMESTAMP(movedate) AS movedate
from move_objects where status = '".$status."'
$options",$tabOptions);
echo "$tabOptions";
}
The hard coded version that works is below.
function selectData($title,$options,$status,$tabOptions)
{
echo "$title";
$table = new buildTable("Select *,
UNIX_TIMESTAMP(date) AS date, UNIX_TIMESTAMP(testdate) AS testdate ,
UNIX_TIMESTAMP(movedate) AS movedate
from move_objects where status = '".$status."'
$options","active","'pass','update','delete','nothing'");
echo "$tabOptions";
}
The echo "$tabOptions" is in there to debug and returns
"active","'pass','update','delete','nothing'" - which is exactly the
synatax of the hard coded version. I've tried no quotes, single quotes, double quotes both before and after my function call.
I'd appreciate any help. I'm trying to build a MYSQL SQL engine with a HTML interface.