我的查询中的mysql语法有什么问题

时间:2022-06-06 21:42:01

Here is the query:

这是查询:

$result = mysql_query( "SELECT t.FirstName, t.LastName, g.GymName, t.City, t.State
                            FROM target t
                            INNER JOIN targetarea tg ON t.targetID=tg.targetID
                            WHERE t.targetID='$id'" );  

echo $result;

Only problem is, nothing gets printed therefore i have a mysql syntax error, so what am i doing wrong?

唯一的问题是,没有任何内容被打印因此我有一个mysql语法错误,所以我做错了什么?

1 个解决方案

#1


3  

You have g.GymName in the SELECT list but the table alias is tg not g (may be other issues as well I'm not a php-er but that one jumped out at me).

你在SELECT列表中有g.GymName但是表别名是tg而不是g(可能是其他问题我也不是php-er但是那个跳出来了)。

#1


3  

You have g.GymName in the SELECT list but the table alias is tg not g (may be other issues as well I'm not a php-er but that one jumped out at me).

你在SELECT列表中有g.GymName但是表别名是tg而不是g(可能是其他问题我也不是php-er但是那个跳出来了)。