Alphanumeric column name not working in SQL or PHP statements

Discussion in 'PHP' started by Darden12, Feb 5, 2009.

  1. #1
    Background:

    I have a database field called Fun_Date2. The field contains records in the form of a php command, like
    
    include 'whatever.php';
    
    PHP:
    which are eventually executed in a php script using the eval function.

    This is not the problem, however. This much works fine. I include this info merely for background info.

    Problem:


    The problem is that the following SQL statement involving this column produces no results, whereas it should produce a half-dozen:
    
    SELECT * FROM MyTable WHERE Fun_Date2 != ''
    PHP:
    When I run the above in a php script, it should retrieve all records where the Fun_Date2 field is not empty -- instead, it retrieves no records at all, although there are actually a dozen records in the database where the Fun_Date2 field is not empty.

    If I replace Fun_Date2 with any other field name in my database, the statement works as expected.

    Any ideas why the statement does not produce the expected result for the column called Fun_Date2?

    Thanks in advance,

    Brian
     
    Darden12, Feb 5, 2009 IP
  2. Darden12

    Darden12 Well-Known Member

    Messages:
    107
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #2
    Oops! The column name was working fine. It was my brain that was on the fritz. I had exported the records that I was searching for to another table last week.

    Thanks anyway!

    Brian
     
    Darden12, Feb 5, 2009 IP