can someone help me with what's wrong with this SQL query, there's something wrong with the concat function;
$query=mysql_query ("SELECT CONCAT('<a href="', user_url, '">', display_name, '</a>') 'Autor', FROM wp_posts")
phpfiddle says Message : syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
Thanks
You're missing a comma after the CONCAT
section:
SELECT CONCAT('<a href="', user_url, '">', display_name, '</a>'), Author FROM wp_posts
Edit
OK, now you've updated the code to include the PHP I can see the problem. You're not escaping the double quotes in your query:
$query=mysql_query ("SELECT CONCAT('<a href=\"', user_url, '\">', display_name, '</a>'), Author FROM wp_posts")
Incidentally, you shouldn't be using the mysql_*
functions.
The above error, it is a PHP error, not the SQL. So check your PHP syntax. The SQL looks ok.
Try this one:
$query = <<<SQL
SELECT CONCAT('<a href="', user_url, '">', display_name, '</a>'), autor FROM wp_posts
SQL;