user656925
user656925

Reputation:

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 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.

Upvotes: 0

Views: 209

Answers (3)

Lawrence Cherone
Lawrence Cherone

Reputation: 46602

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

Upvotes: 1

sagi
sagi

Reputation: 5737

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.

Upvotes: 3

scwagner
scwagner

Reputation: 4005

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.

Upvotes: 2

Related Questions