For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > May 2006 > OT MySQL 5









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author OT MySQL 5
huwpioden@gmail.com

2006-05-29, 6:58 pm

Hi all,

I've just moved my development server to FC5 which includes MySQL 5.
Everything is fine except this one query!!

SELECT DISTINCT n.nav_order,
n.cat_id,
IF((LENGTH(c.category) > 0),c.category,s.title) as
title,
IF((LENGTH(c.category) > 0),'',n.page_id) as page_id
FROM navigation n,
story s
LEFT JOIN categories c ON c.cat_id = n.cat_id
WHERE nav_order IS NOT NULL AND
n.page_id = s.page_uid
ORDER BY nav_order

It used to work just fine but now it get the following query:
Couldn't execute navigation query.Unknown column 'n.cat_id' in 'on
clause'

Any ideas what's wrong?

TIA

Huw

Ian Pawson

2006-05-29, 6:58 pm

huwpioden@gmail.com wrote:
> Hi all,
>
> I've just moved my development server to FC5 which includes MySQL 5.
> Everything is fine except this one query!!
>
> SELECT DISTINCT n.nav_order,
> n.cat_id,
> IF((LENGTH(c.category) > 0),c.category,s.title) as
> title,
> IF((LENGTH(c.category) > 0),'',n.page_id) as page_id
> FROM navigation n,
> story s
> LEFT JOIN categories c ON c.cat_id = n.cat_id
> WHERE nav_order IS NOT NULL AND
> n.page_id = s.page_uid
> ORDER BY nav_order
>
> It used to work just fine but now it get the following query:
> Couldn't execute navigation query.Unknown column 'n.cat_id' in 'on
> clause'
>
> Any ideas what's wrong?
>
> TIA
>
> Huw
>

This is due to the 5 parses the columns. From memory, You have to change
the order of the statements. It is some time ago that I changed my code
to version 5, so I can't remember exactly which bits to move - sorry.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com