Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed double quotes in $val field
    primarykey
    data
    text
    <p>We are creating a file such that when we execute the file we push an array into a new PHP file . We are able to print the array details in new PHP file but we are not able to get the double quotes for the $val fields . </p> <p>Code is as follows</p> <pre><code>&lt;?php include_once("../dc/dcCommonLib.php"); include_once("../dc/persistence/UserData.php"); require_once("../../lib/include/connect.inc.php"); $_SESSION["survey"] = "BestBuyAug2012"; $idLink = dbconnect($_SESSION["survey"]); $surveyWidget = rendererSurveyLoadHandler(); setDataToSession("surveywidget",$surveyWidget); $userData = &amp;UserData::getInstance(); $userData-&gt;setSurvey($surveyWidget); saveFkidsToOidToFkidMappingArray($userData-&gt;OidToFkidMapping); // prepare demo array prepareItemArray($userData-&gt;OidToFkidMapping["Demographic"]["Q"],$demo,"b"); // prepare item array prepareItemArray($userData-&gt;OidToFkidMapping["Default"]["Q"],$item,"i"); prepareItemArray($userData-&gt;OidToFkidMapping["Default"]["M"],$item,"i"); // prepare comment array prepareCommentArray($userData-&gt;OidToFkidMapping["Comment"]["C"],$comment); if (!function_exists('file_put_contents')) { /* ... define that function then ... */ } print("Strart writting ..................."); file_put_contents("Test.php", $file,"",true); file_put_contents("Test.php", "&lt;?php\n","",true); file_put_contents("Test.php", $item,"itemFkids",true); file_put_contents("Test.php", $demo,"demoFkids",true); file_put_contents("Test.php", $comment,"commentFkids",true); file_put_contents("Test.php", "?&gt;","",true); print("written ..."); function prepareItemArray($userDataArray, &amp;$item, $itemStr) { if(is_array($userDataArray)) { foreach($userDataArray as $questId=&gt;$respGrp) { $selectionGrp=array_unique($respGrp); if(count($selectionGrp)==1) { $respGrpId=key($respGrp); $respId = key($respGrp[$respGrpId]); $item[$questId."_".key($respGrp)]=$itemStr.$respGrp[$respGrpId][$respId]; }else { foreach ($respGrp as $respGrpId=&gt;$resp) { $respGrp[$respGrpId]=$itemStr.$resp; } $item[$questId."_".key($respGrp)]=$respGrp; } } } } function prepareCommentArray($userDataArray, &amp;$item) { if(is_array($userDataArray)) { foreach($userDataArray as $questId=&gt;$respGrp) { $selectionGrp=array_unique($respGrp); if(count($selectionGrp)==1) { $respGrpId=key($respGrp); $item[$questId."_".key($respGrp)]=$respGrp[$respGrpId]["fk_id"]; } } } } ?&gt; </code></pre> <p>the array that we get in Test.php is </p> <pre><code>&lt;?php $itemFkids = Array ( "203_19" =&gt; i27,//need double qoutes for all the $val fields "207_22" =&gt; i28,//need double qoutes for all the $val fields "357_22" =&gt; i99,//need double qoutes for all the $val fields "370_70" =&gt; i104,//need double qoutes for all the $val fields "377_72" =&gt; i105,//need double qoutes for all the $val fields ) $demoFkids = Array ( "129_2" =&gt; b1//need double qoutes for all the $val fields ) $commentFkids = Array ( "373_375" =&gt; 1,//need double qoutes for all the $val fields "380_382" =&gt; 2//need double qoutes for all the $val fields ) ?&gt; </code></pre> <p>Any help is appreciated . </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload