PHP/SQL - PHP won't output sql query

2019-09-24 00:58发布

could you please help me? just trying to fill in some text as stackoverflow wants to write more text because it's all code

2条回答
叼着烟拽天下
2楼-- · 2019-09-24 01:25

alias on this field

SELECT f.roundID as froundID

then use single quotes not double

$row['froundID']

AND THE BIGGER PROBLEM IS THE SQL QUERY

FROM fixtures AS f
INNER JOIN team AS h
  ON f.homeTeam = h.teamID
  AND f.awayTeam = h.teamID

which will not return anything because the awayteam and hometeam should be the same in a row...

to correct should be OR where it can be either the hometeam or awayteam

FROM fixtures AS f
INNER JOIN team AS h
  ON (f.homeTeam = h.teamID
  OR f.awayTeam = h.teamID)

with the updated requirement you need to create 3 queries
where
1 - get the rounds
2 - get the teams
3 - get the venue

查看更多
看我几分像从前
3楼-- · 2019-09-24 01:28

Your query is like:

select a.column, b.columnz from table a inner join table b on a.key = b.key

So when you get the result like:

column   columnz
xxxxx    yyyyyy

So your PHP

<?php echo $row["f.roundID"]?>"><?php echo $row["f.roundID"]?>

should be in this way:

<?php echo $row["roundID"]?>"><?php echo $row["roundID"]?>

查看更多
登录 后发表回答