I know this question has been asked numerous times, but after search ferociously, I can not seem to find the answer I am looking for. I have a script in *.js format that creates a json data array then stores it in a json file.
The array setup is:
var sessionState = {
currentWalletNdx: 0,
genesisBlockId: 0,
genesisBaseTarget: 0,
genesisBlockTimestamp: 0,
current: {
blockHeight: 0,
baseTarget: 0,
startTime: 0,
totalShare: 0,
submitters: 0,
bestDeadline: 0,
totalPayments: 0,
netDiff: 0
},
prevBlocks: []
};
And to store the data in a json file the function is:
saveSession: function () {
var jsonData = JSON.stringify(sessionState, null, 2);
fs.writeFileSync('pool-session.json', jsonData);
},
My question is, how can I write it in this js file to store the saved json array in a mysql table using the json type so I view the data later using php & mysql?