开发者

How can I create two related tables in MySQL and return a result set as JSON using PHP? [closed]

开发者 https://www.devze.com 2023-03-18 03:03 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, inco开发者_如何学Pythonmplete, overly broad, or rhetorical andcannot be reasonably answered in its current f
It's difficult to tell what is being asked here. This question is ambiguous, vague, inco开发者_如何学Pythonmplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I need to create two related tables in MySQL and return a result set as JSON using PHP.

I have figured out how to get my data from MySQL using PHP and how to encode it to JSON, but I'm not sure how to use Javascript to display the JSON results on my page.

Any help would be appreciated.


This is a very vague question, but here are all the pieces you'll need. Put them together in the way which solves your particular problem:

  1. Basic MySQL usage example: http://us3.php.net/manual/en/mysql.examples-basic.php

  2. Full MySQL documentation: http://us3.php.net/manual/en/book.mysql.php

  3. Getting data from related tables: http://www.keithjbrown.co.uk/vworks/mysql/mysql_p5.php (JOIN directive)

  4. Encode your data in JSON: http://php.net/manual/en/function.json-encode.php

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号