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.
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
COMMENTSbut the table name, presumably, iscomments.See Identifier Case Sensitivity in the MySQL manual for more information.