tags:

views:

42

answers:

1

Hi there,

i am getting an error while querying this select statement.

 $comments = dbgetvar("SELECT SUM(CASE WHEN c.approve = '1' AND c.spam = '0' THEN 1 ELSE 0 END) AS approved,
                       SUM(CASE WHEN c.approve = '0' AND c.spam = '0' THEN 1 ELSE 0 END) AS pending,
                       SUM(CASE WHEN c.spam = '1' THEN 1 ELSE 0 END) AS spam,
                       COUNT(*) AS count
                       FROM COMMENTS c");

the above code works fine on my local machine using WAMP server. but when i host it in my server powered by cpanel it gives the following error.

Notice: dbget: Table 'bhatkaln_test.COMMENTS' doesn't exist in SELECT SUM(CASE WHEN c.approve = '1' AND c.spam = '0' THEN 1 ELSE 0 END) AS approved, SUM(CASE WHEN c.approve = '0' AND c.spam = '0' THEN 1 ELSE 0 END) AS pending, SUM(CASE WHEN c.spam = '1' THEN 1 ELSE 0 END) AS spam, COUNT(*) AS count FROM COMMENTS c in /home/bhatkaln/public_html/test/admin-login/models/validation.php on line 154

what does the above error mean? in the database the comments table do exist.

+3  A: 

You are testing your server on Windows, where the table names are not case sensitive, since they ultimately refer to files.

When you upload to your Linux based server, the file system there is case sensitive. It doesn't work because you specify COMMENTS but the table name, presumably, is comments.

See Identifier Case Sensitivity in the MySQL manual for more information.

Paul Dixon
correct. let me try this out. it might be of case sensitive problem.
Ibrahim Azhar Armar
problem solved. although i knew about this thing. it went unnoticed. thank you :)
Ibrahim Azhar Armar