Welcome Guest, Not a member yet? Register   Sign In
JSON PROB
#3

[eluser]kptengco[/eluser]
im inserting it to a table and result is empty but when i insert this
Code:
$_REQUEST['jsonData']

it has its values
Code:
{"SC_MC":"00000000","SC_MID":"00000000","SC_AMOUNT":5000,"SC_REF":"0000"
,"SC_PAYMODE":"Regular Installment","SC_PAYTERM":"12","SC_TRANSIP":"undefined","SC_PAYREF":"000000000000"
,"SC_PAYDATE":"2012-05-21","SC_REFERRER":"https:\/\/abc.abc.com\/abc\/abc\/abc.php","SC_AGENT":"Mozilla
\/5.0 (Windows NT 6.1; rv:12.0) Gecko\/20100101 Firefox\/12.0","SC_RRN":null,"SC_CUR_DATA":"PHP|1"
,"SC_ORIG_AMOUNT":5000
,"SC_STATUS":"approved"}

just like this
Code:
$dataDecoded = json_decode($_REQUEST['jsonData']);

"INSERT INTO tbl (field1) VALUES('".addslashes($dataDecoded->name)." | ".$_REQUEST['jsonData']."')";

//when i view the table the data was there but the $dataDecoded->name is empty
I tried to select that data to my table then use "json_decode" it works. The question is why its not decoding at first its only decoding after it has recorded in my table and select then decode it.

Code:
"SELECT dataCode FROM tbl";

$decodeValues = json_decode(dataCode);

$decodeValues->name; //this works now it has its value


Messages In This Thread
JSON PROB - by El Forum - 05-21-2012, 01:31 AM
JSON PROB - by El Forum - 05-21-2012, 11:24 AM
JSON PROB - by El Forum - 05-21-2012, 07:18 PM
JSON PROB - by El Forum - 05-22-2012, 01:47 AM
JSON PROB - by El Forum - 05-22-2012, 08:18 AM
JSON PROB - by El Forum - 05-22-2012, 07:36 PM
JSON PROB - by El Forum - 05-22-2012, 07:50 PM
JSON PROB - by El Forum - 05-22-2012, 07:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB