简体   繁体   English

PHP,MySQL,Google Maps问题

[英]PHP, MySQL, Google Maps Questions

I'm attempting to build a web app and I've run into a bit of a wall. 我正在尝试构建一个Web应用程序,但遇到了一些困难。 I'm not asking for anyone to hold my hand through making this, just some advice and a push in the right direction. 我并不是在要求任何人握住我的手,只是提供一些建议和朝正确方向推进。

So, I'm trying to build an app that uses the Google Maps API to display a map of local parks near you and allow people to post pickup games (informal sporting events) for a specific time at a specific park. 因此,我正在尝试构建一个使用Google Maps API的应用程序,以显示您附近的本地公园的地图,并允许人们在特定时间段的特定时间内发布接送游戏(非正式体育赛事)。 Simple enough right? 很简单吧?

So far I've created a database with a table of local parks (columns: name, longitude, latitude) and a php script that takes that table and turns it into an XML file that the map uses to plot the points of the parks. 到目前为止,我已经创建了一个包含本地公园表(列:名称,经度,纬度)的数据库,以及一个使用该表并将其转换为XML文件的php脚本,地图使用该XML文件来绘制公园点。 I've also created a form that uses php to insert new data into the table and thus create a new park marker on the map. 我还创建了一个表单,该表单使用php将新数据插入表格中,从而在地图上创建新的公园标记。

This has all gone well so far but I'm just not sure how to proceed. 到目前为止,一切进展顺利,但我不确定如何进行。 I think I want to create a table 'games' (columns: sport, time, park(?)) but I'm not sure if that will work. 我想我想创建一个表格“游戏”(列:运动,时间,公园(?)),但我不确定这是否可行。 Will I be able to setup a relationship between the 'parks' and 'games' table so that many games belong to a park? 我能否在“公园”和“游戏”表之间建立关系,以便许多游戏都属于公园? If so, how would I map those games? 如果是这样,我将如何映射这些游戏? Does my thinking make sense? 我的想法有意义吗?

If you'll create games table with sport_id | time | park_id 如果要使用sport_id | time | park_id创建gamessport_id | time | park_id sport_id | time | park_id sport_id | time | park_id columns, then game entity will be related to park entity by one-to-many relation. sport_id | time | park_id列,则game实体将通过one-to-many关系与park实体相关。 It means that one park handles 0..Many games and one game always belongs to one park. 这意味着一个公园处理0..Many游戏和一个游戏始终属于一个公园。

So, this is suitable solution for your issue. 因此,这是适合您的问题的解决方案。 It fits your expectations. 符合您的期望。

Additional info about relations: Cardinality 有关关系的附加信息: 基数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM