4
1
|
I am currently using a JSON encoded array to display the users in my database for an auto-suggest feature. It looks something like this:
This returns:
My question is somewhat 2-fold: First, how would I manually add an additional object to this output? For example, let's say I wanted to add: Thus, it'd look like:
Second, let's say I also wanted to add more objects to the array from a separate table as well, such as:
This way I could have both tables populated in the JSON array, thus, showing up as additional options in my autosuggest. Hopefully this makes sense, as I've tried hard to articulate what I am trying to accomplish. Thanks! | ||||
|
8
|
Just keep pushing to the
Then at the very end, do your And if you have separate scripts, combine them in one php page. | ||||
|
0
|
You could edit the JSON (text), but it's much easier to modify the array before you encode it. Or am I missing something? | ||
0
|
I'm not an expert in any of these fields, but I'll try and see if I can help. Try one of these: Option 1 (I don't know how unions work in mysql):
I've never done PHP, so I'm making assumptions. I've also never used MySql, so there's more assumptions. Option 2:
Hope this helps. |
4
1
|
I am currently using a JSON encoded array to display the users in my database for an auto-suggest feature. It looks something like this:
This returns:
My question is somewhat 2-fold: First, how would I manually add an additional object to this output? For example, let's say I wanted to add: Thus, it'd look like:
Second, let's say I also wanted to add more objects to the array from a separate table as well, such as:
This way I could have both tables populated in the JSON array, thus, showing up as additional options in my autosuggest. Hopefully this makes sense, as I've tried hard to articulate what I am trying to accomplish. Thanks! | ||||
|
8
|
Just keep pushing to the
Then at the very end, do your And if you have separate scripts, combine them in one php page. | ||||
|
0
|
You could edit the JSON (text), but it's much easier to modify the array before you encode it. Or am I missing something? | ||
0
|
I'm not an expert in any of these fields, but I'll try and see if I can help. Try one of these: Option 1 (I don't know how unions work in mysql):
I've never done PHP, so I'm making assumptions. I've also never used MySql, so there's more assumptions. Option 2:
Hope this helps. |