Jump to content

CONCAT sql


ibrahimjan
 Share

Recommended Posts

Hi All, I got this sql connection to my table wb, it all seems to work fine in phpmyadmin, when testing sql, but when i want to us it, it comes up with: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING inC:\----------\test3.php on line 75 line 75 is the $query_wb

$query_wb = "SELECT	 CONCAT( "[",		 GROUP_CONCAT(			 CONCAT("{weID:'",`weID`,"'"),			 CONCAT(",weName:'",`weName`,"'}")		 )	 ,"]") AS json FROM wb;";

any Ideas how to make it work??

Edited by Ibrahim Home Jan
Link to comment
Share on other sites

You need to escape the double quotes that you're using inside the query. Notice how the code is colored, each time you use a double quote inside the query it either starts or ends the query string instead of putting an actual quote in the query.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...