Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #3297 > unrolled thread

PHP script after querying a DB

Started bysandreev <sanjeevtm@gmail.com>
First post2011-10-03 17:02 -0700
Last post2011-10-03 21:30 -0400
Articles 2 — 2 participants

Back to article view | Back to comp.lang.php


Contents

  PHP script after querying a DB sandreev <sanjeevtm@gmail.com> - 2011-10-03 17:02 -0700
    Re: PHP script after querying a DB Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-03 21:30 -0400

#3297 — PHP script after querying a DB

Fromsandreev <sanjeevtm@gmail.com>
Date2011-10-03 17:02 -0700
SubjectPHP script after querying a DB
Message-ID<409ac72a-24b6-4798-b4f1-57ea8830234d@i30g2000yqd.googlegroups.com>
I am looking for a script that can output the data in the following
format.
Basically I am querying a DB to encode the output in a variation of
JSON format.

{
  "cols": [
        {"id":"","label":"Topping","pattern":"","type":"string"},
        {"id":"","label":"Slices","pattern":"","type":"number"}
      ],
  "rows": [
        {"c":[{"v":"Mushrooms","f":null},{"v":3,"f":null}]},
        {"c":[{"v":"Onions","f":null},{"v":1,"f":null}]},
        {"c":[{"v":"Olives","f":null},{"v":1,"f":null}]},
        {"c":[{"v":"Zucchini","f":null},{"v":1,"f":null}]},
        {"c":[{"v":"Pepperoni","f":null},{"v":2,"f":null}]}
      ]
}

My approach is to store columns related array in variable1 and then
rows related array in variable2 and then print both. Any help in this
regard is highly appreciated.

thank you,

[toc] | [next] | [standalone]


#3299

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-10-03 21:30 -0400
Message-ID<j6dnj0$6cl$1@dont-email.me>
In reply to#3297
On 10/3/2011 8:02 PM, sandreev wrote:
> I am looking for a script that can output the data in the following
> format.
> Basically I am querying a DB to encode the output in a variation of
> JSON format.
>
> {
>    "cols": [
>          {"id":"","label":"Topping","pattern":"","type":"string"},
>          {"id":"","label":"Slices","pattern":"","type":"number"}
>        ],
>    "rows": [
>          {"c":[{"v":"Mushrooms","f":null},{"v":3,"f":null}]},
>          {"c":[{"v":"Onions","f":null},{"v":1,"f":null}]},
>          {"c":[{"v":"Olives","f":null},{"v":1,"f":null}]},
>          {"c":[{"v":"Zucchini","f":null},{"v":1,"f":null}]},
>          {"c":[{"v":"Pepperoni","f":null},{"v":2,"f":null}]}
>        ]
> }
>
> My approach is to store columns related array in variable1 and then
> rows related array in variable2 and then print both. Any help in this
> regard is highly appreciated.
>
> thank you,

I don't think you'll find anything which will do what you want.  But it 
shouldn't be very hard to create such a script.  What have you tried so far?

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web