Jump to content

Recommended Posts

Hi, complete newbie and novice here so bear with me.

 

I am getting the error < Unknown column 'S.SeasonID' in 'on clause' > here:

http://www.fleethistory.co.uk/stats/player.php?id=127&oppid=

 

When it should look like this:

http://mercury.nethostcomputer.com/~fleet/stats/player.php?id=127&oppid=

 

From searching these forums, I've worked out it's because the offending site is using MySQL5 and also something to do with commas and LEFT JOINs (as I said, I'm a novice!).

 

And I'm guessing this is where I need to change it:

 

{
    $get_seasons = mysql_query("SELECT SE.SeasonName AS name, S.SeasonID AS id, COUNT( A.AppearancePlayerID ) AS apps
    FROM tplss_seasons S, tplss_seasonnames SE
    LEFT OUTER JOIN tplss_matches M ON M.MatchSeasonID = S.SeasonID AND M.MatchTypeID = '$defaultmatchtypeid'
    LEFT OUTER JOIN tplss_appearances A ON A.AppearancePlayerID = '$id' AND A.AppearanceSeasonID = S.SeasonID AND A.AppearanceMatchID = M.MatchID
    WHERE SE.SeasonID = S.SeasonID AND S.SeasonPlayerID = '$id'
    GROUP BY S.SeasonID
    ORDER BY name",$connection)
    or die(mysql_error());

 

Is anyone able to tell me exactly what I need to replace to get this working?

Link to comment
https://forums.phpfreaks.com/topic/215410-unknown-column-in-on-clause/
Share on other sites

This is why you shouldn't mix join syntax. Try fenway's suggestion, or change all the joins to explicit joins -

 

Change:

FROM tplss_seasons S, tplss_seasonnames SE

 

To:

FROM tplss_seasons AS S

INNER JOIN tplss_seasonnames AS SE ON SE.SeasonID = S.SeasonID

 

And make sure to remove that condition from the WHERE clause

Thanks both - I tried the first one but no luck.

 

This is why you shouldn't mix join syntax. Try fenway's suggestion, or change all the joins to explicit joins

 

Could you tell me how to do that? I am using third-party software of which I usually just use the admin back-end. The software developer no longer offers any support and I've never had to look into the nuts and bolts of the PHP pages until this problem occurred.

I showed you exactly how in my previous response. You join the first two tables using the implicit syntax (separating them with a comma) and the rest using the explicit (specifying the join type and on clause). I suggested you change the implicit syntax to the explicit syntax and wrote the exact statements to use

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.