开发者

Why does mySQL concat fail on a different platform?

PHP is returning the error:

"FUNCTION archemar_1.concat does not exist"

The only place in my php file where I call the concat function is here, if indeed that is the problem.

$full_name = database::query("SELECT concat (fname, ' ', lname) from cr WHERE email='$email'");

This function runs fine on my local xampp server but not when I upload it开发者_Python百科 to my production server. This makes me think it is a platform issue perhpas with having to do with the PHP or mySQL version and the syntax I'm using. If any more info. is needed I can post it.

Thanks.


Try without the space between the function name and the parenthesis:

$full_name = database::query("SELECT concat(fname, ' ', lname) from cr WHERE email='$email'");

See http://datacharmer.blogspot.com/2005/12/function-wellknownfunc-does-not-exist.html for more information.


Remove the space between CONCAT and the open parenthesis. This is a place where MySQL is picky -- if you have a space between the function name and the open parenthesis then it is attempting to resolve it as a user-defined functions. Built-in functions do not use a space.


 $full_name = database::query("SELECT concat_ws(' ', fname, lname) AS fullname
                               FROM cr 
                               WHERE email='$email'");
 $fullname['fullname'];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜