I am currently using CI to develop a small application - I am running the majority of queries using a query chain, but I am running into an issue inserting spaces using the CONCAT function as seen below:
$this->db->select('P.PizzaID, P.PizzaName AS Pizza Name, S.SupplierCode AS Supplier Code, P.CookingTime AS Cooking Time, CONCAT(S.SupplierTitle, ' ', S.SupplierFirstName, ' ', S.SupplierLastName) AS Name')
->from('Pizzas P, Supplier S')
The query errors as I want to insert spaces in between getting each value. What am I doing wrong?
If you want to include quotes inside a php string, you need to either use a different style quote than the enclosing quotes of the string, or escape the inner quotes with a backslash.
Each of your single quotes is actually opening and closing the outer string, causing a syntax error.