Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8265385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:46:56+00:00 2026-06-08T04:46:56+00:00

We are creating a file such that when we execute the file we push

  • 0

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 .

Code is as follows

<?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 = &UserData::getInstance();
$userData->setSurvey($surveyWidget);
saveFkidsToOidToFkidMappingArray($userData->OidToFkidMapping);

// prepare demo array
prepareItemArray($userData->OidToFkidMapping["Demographic"]["Q"],$demo,"b");

// prepare item array
prepareItemArray($userData->OidToFkidMapping["Default"]["Q"],$item,"i");
prepareItemArray($userData->OidToFkidMapping["Default"]["M"],$item,"i");

// prepare comment array
prepareCommentArray($userData->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", "<?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", "?>","",true);

print("written ...");

function prepareItemArray($userDataArray, &$item, $itemStr) {
    if(is_array($userDataArray)) {
        foreach($userDataArray as $questId=>$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=>$resp) {
                    $respGrp[$respGrpId]=$itemStr.$resp;
                }
                $item[$questId."_".key($respGrp)]=$respGrp;
            }
        }
    }   
}

function prepareCommentArray($userDataArray, &$item) {
    if(is_array($userDataArray)) {
        foreach($userDataArray as $questId=>$respGrp) {
            $selectionGrp=array_unique($respGrp);
            if(count($selectionGrp)==1) {
                $respGrpId=key($respGrp);               
                $item[$questId."_".key($respGrp)]=$respGrp[$respGrpId]["fk_id"];            
            }
        }
    }   
}

?>

the array that we get in Test.php is

<?php
$itemFkids = Array
(
    "203_19" => i27,//need double qoutes for all the $val fields
    "207_22" => i28,//need double qoutes for all the $val fields
    "357_22" => i99,//need double qoutes for all the $val fields
    "370_70" => i104,//need double qoutes for all the $val fields
    "377_72" => i105,//need double qoutes for all the $val fields
)
$demoFkids = Array
(
    "129_2" => b1//need double qoutes for all the $val fields
)
$commentFkids = Array
(
    "373_375" => 1,//need double qoutes for all the $val fields
    "380_382" => 2//need double qoutes for all the $val fields
)
?>

Any help is appreciated .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T04:46:59+00:00Added an answer on June 8, 2026 at 4:46 am

    Replace $data[$key] .= ','; with $data[$key] .= '",';

    Edit:

    $data[$key] = '"'.$data[$key].'",';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm considering creating a file manager that keeps track of files on a user's
I am new to WIX and have been tasked with creating an installer that
I'm creating a bactch file, which in turn needs to create and execute another
I'm trying to write a configure.ac file such that the resulting configure script searches
I'm creating build file for phing. The problem is that it must move a
I started creating file downloader class. Here is what i have: public class Downloader
I am creating file upload script and I'm looking for the best techniques and
i need some help with creating file Im trying in the last hours to
I am creating a file manager application using vaadin as ui and alfresco as
I am creating excel file using below code public class ResultSetToExcel { private HSSFWorkbook

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.