开发者

do i have to specify the database name in select statement while hosting?

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 fi开发者_如何学运维ne 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 COMMENTS but the table name, presumably, is comments.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜