我在我的应用程序中填充List。在另一个Activity中,我试图让每个“事件”在ListView中显示。因此,我设立了一个EditText,让我进入一个城市,例如“汉堡”。点击确认按钮后,该列表应显示在汉堡的所有事件。从MySQL中选择
+---------+----------+----------+------------------+
| user_id | name | location | description |
+---------+----------+----------+------------------+
| 5 | Dinner | Hamburg | With the Family |
| 6 | Marriage | Bremen | Alex and Sabrina |
| 7 | Match | Berlin | Hamburg - Hertha |
| 8 | Meeting | Berlin | Alexanderplatz |
| 9 | Cinema | Berlin | FUG2 |
+---------+----------+----------+------------------+
我的问题,我想不出如何声明PHP文档中的SQL语句。所有我拥有的是:
$result = mysql_query("SELECT * FROM events WHERE location = ':location'") or die(mysql_error());
删除 ':位置' 单引号和检查 – rajuGT
你在哪里设置':location'? –
纠正我,如果我错了,但'mysql_ *'甚至有参数化的查询支持? –