Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #3299
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: PHP script after querying a DB |
| Date | 2011-10-03 21:30 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <j6dnj0$6cl$1@dont-email.me> (permalink) |
| References | <409ac72a-24b6-4798-b4f1-57ea8830234d@i30g2000yqd.googlegroups.com> |
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
==================
Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread
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
csiph-web