Closed Thread
Results 1 to 8 of 8

Thread: Unknown column?

  1. #1
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Unknown column?

    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.visiblegalpics.vimagegalleries.idgalpics.gallery FROM `galpicsLEFT JOIN galleries ON galleries.id=galpics.gallery WHERE `galpics.gallery`='$gall' && `vimage`=&& `visible`=1 ORDER BY `orderASC 

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Re: Unknown column?

    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!

  4. #3
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: Unknown column?

    Shouldn't you use "AND" instead of "&&"?
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  5. #4
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Re: Unknown column?

    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?

  6. #5
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: Unknown column?

    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.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  7. #6
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Re: Unknown column?

    Well I even tried some other things I did something my bosses suggested like:

    Code:
    SELECT FROM table1,table WHERE table1.id=table2.gallery 
    Something to that effect and the same error occured saying "table2.gallery column is unknown"

  8. #7
    Jordan Guest

    Re: Unknown column?

    Can we see your database schema?

  9. #8
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Re: Unknown column?

    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...

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Help programming language to use is currently unknown
    By zigmaphi in forum General Programming
    Replies: 2
    Last Post: 01-05-2011, 08:52 AM
  2. Getting the size of an unknown array in C
    By ic3m4n in forum C and C++
    Replies: 8
    Last Post: 12-16-2010, 05:45 AM
  3. Intel scamming the unknown?
    By Turk4n in forum The Lounge
    Replies: 7
    Last Post: 02-03-2010, 09:26 AM
  4. Unknown column in 'field list'
    By ankimo in forum Database & Database Programming
    Replies: 1
    Last Post: 12-20-2008, 07:47 PM
  5. Unknown column 'member' in 'where clause' Help PHP
    By coated_pill in forum PHP Development
    Replies: 2
    Last Post: 07-25-2008, 04:47 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts