Well it says I have an unknown column but it does exist since I include it and even use it to left joint he dumb thing! What is wrong with my query?
Code:SELECT galleries.visible, galpics.vimage, galleries.id, galpics.gallery FROM `galpics` LEFT JOIN galleries ON galleries.id=galpics.gallery WHERE `galpics.gallery`='$gall' && `vimage`=1 && `visible`=1 ORDER BY `order` ASC
I tried adding the "galleries.id as gally" and tried "gally" in the WHERE and it did the same thing? What?
When I var_dump the contents of the query without it it still works... is this a glitch? I must be doing something wrong!
Shouldn't you use "AND" instead of "&&"?
Still an error. I have always used && tho I thought it was valid? Or is that one of those things that depends on the version of sql etc?
For something like that, I would start by getting just one field at a time to see which is causing the error. If none, then go through the join conditions, etc.
Well I even tried some other things I did something my bosses suggested like:
Something to that effect and the same error occured saying "table2.gallery column is unknown"Code:SELECT * FROM table1,table WHERE table1.id=table2.gallery
Can we see your database schema?
Sorry about the delayed reply... it works now but im very confused... when I first learned any type of SQL they told me to make it pretty and lovely I should use the same standard as other people and the most common was to put backticks around table names and column names, and regular single quotes around strings and variables... but now when I remove the backticks it works?
How is this even possible? Is it my version of SQL maybe? How do I even find it? The hosting company I am using with this project is 1&1 very big and unlikely to have outdated things...
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks