All pastes #985241 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-04-14 21:28 UTC
rendered paste body
//actual code:

$json = "[{\"description\":\"12345678\",\"class_id\":669},{\"title\":\"AI Stretch  Strength TEST\",\"class_id\":660},{\"web_category\":\"category 3\",\"description\":\"For test\",\"title\":\"Class test\",\"class_id\":663}]";
	var_dump(json_decode($json));
	var_dump(json_decode($json, true));


//Result for var dump

// WHAT I NEED:
// I HAVE AN EDITABLE GRID THAT SENDS THE CHANGED FIELDS USING JSON TO MY PHP PROCESS PAGE
// I WOULD LIKE TO MAKE A METHOD THAT SAVE THE CHANGES (AN UPDATE QUERY FOR MULTIPLE RECORDS)

array(3) {
  [0]=>
  object(stdClass)#1 (2) {
    ["description"]=>
    string(8) "12345678"
    ["class_id"]=>
    int(669)
  }
  [1]=>
  object(stdClass)#2 (2) {
    ["title"]=>
    string(25) "AI Stretch  Strength TEST"
    ["class_id"]=>
    int(660)
  }
  [2]=>
  object(stdClass)#3 (4) {
    ["web_category"]=>
    string(10) "category 3"
    ["description"]=>
    string(8) "For test"
    ["title"]=>
    string(10) "Class test"
    ["class_id"]=>
    int(663)
  }
}
array(3) {
  [0]=>
  array(2) {
    ["description"]=>
    string(8) "12345678"
    ["class_id"]=>
    int(669)
  }
  [1]=>
  array(2) {
    ["title"]=>
    string(25) "AI Stretch  Strength TEST"
    ["class_id"]=>
    int(660)
  }
  [2]=>
  array(4) {
    ["web_category"]=>
    string(10) "category 3"
    ["description"]=>
    string(8) "For test"
    ["title"]=>
    string(10) "Class test"
    ["class_id"]=>
    int(663)
  }
}