Ignoring fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aktar
    New Member
    • Jul 2006
    • 105

    Ignoring fields

    Consider the query below

    [CODE=mysql]SELECT exists1, exists2, non_existant FROM table[/CODE]

    If the fileld non_existant does not exist, would it then be possible to get mysql to ignore this field?
  • mwasif
    Recognized Expert Contributor
    • Jul 2006
    • 802

    #2
    Didn't understand.

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      No, you'll get an error message 'unknown column .. etc...' and the query will not be executed. Or you can suppress the message, but you still won't get a result. Out of curiosity: why would you want to select a column that does not exist?

      Would it not be easier to check the existence of the columns of the table and use that to construct your query?

      Ronald

      Comment

      • aktar
        New Member
        • Jul 2006
        • 105

        #4
        Originally posted by ronverdonk
        No, you'll get an error message 'unknown column .. etc...' and the query will not be executed. Or you can suppress the message, but you still won't get a result. Out of curiosity: why would you want to select a column that does not exist?

        Would it not be easier to check the existence of the columns of the table and use that to construct your query?

        Ronald

        Well the query will be auto generated depending on _REQUEST variables. It will be easy to fool the script with extra information, hence wanting to ignore non-existing fields.

        BTW, how do you supress errors thrown by mysql?

        Comment

        Working...