Is there something wrong with using the following:
$test .= '$row[\''.$row[0].'\'].';
//When echo'ed shows
echo $test;
//$row['CustomerID'].$row['CompanyName']
//I have used it like this
eval($test)
PHP complains:
Parse error: parse error in C:\w.php(73) : eval()'d code on line 1
I can't see where the parse error is. Please help.
Update + More Detail
function get_rows(){
//This function needs to find out what columns it will query for
//so it calls get_columns()
while($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_NUMERIC)){
$pdf->Cell(0,10, eval($column_names) ,0,1);
}
function get_columns(){
//returns a string of the columns that need to
//be retrieved
return $column_names;
}
I have a PDF creator in function get_rows() which needs to be passed a string which is the value of the evaluated code I have shown above.
I have condensed what is happening as there is too much code.