Welcome Guest, Not a member yet? Register   Sign In
T_CONSTANT_ENCAPSED_STRING
#1

[eluser]xtremer360[/eluser]
Code:
$this->db->select("DATE_FORMAT(".$this->master_model->news_articles_table.".news_article_posting_date, '%M %D, %Y') AS news_article_posting_date", FALSE);
$this->db->select("CONCAT_WS(' ', ".$this->master_model->users_table.".first_name.".$this->master_model->users_table.".last_name) AS author", FALSE);

Any idea why I'm getting a T_CONSTANT_ENCAPSED_STRING error with these two lines?
#2

[eluser]yacman[/eluser]
Try it like this:

Code:
$this->db->select("DATE_FORMAT({$this->master_model->news_articles_table}.news_article_posting_date, '%M %D, %Y') AS news_article_posting_date", FALSE);
$this->db->select("CONCAT_WS(' ', {$this->master_model->users_table}.first_name.{$this->master_model->users_table}.last_name) AS author", FALSE);


#3

[eluser]xtremer360[/eluser]
Same result.

#4

[eluser]PhilTem[/eluser]
I don't get any T_CONSTANT_ENCAPSED_STRING errors using your code. Are you sure it's these lines?
#5

[eluser]CroNiX[/eluser]
What query does it produce?
#6

[eluser]xtremer360[/eluser]
Yeah my bad it was the line below it and I just didn't see it the first couple of times looking at it.
Sorry guys.
#7

[eluser]xtremer360[/eluser]
I take that back.

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.last_name) AS author, `news_article_categories`.`news_article_category_name` FR' at line 1

SELECT `news_articles`.`news_article_id`, `news_articles`.`news_article_title`, DATE_FORMAT(news_articles.news_article_posting_date, '%M %D, %Y') AS news_article_posting_date, CONCAT_WS(' ', users.first_name.users.last_name) AS author, `news_article_categories`.`news_article_category_name` FROM (`news_articles`) JOIN `users` ON `users`.`user_id` =`news_articles`.`news_article_author_id` JOIN `news_article_categories` ON `news_article_categories`.`news_article_category_id` =`news_articles`.`news_article_category_id`
#8

[eluser]CroNiX[/eluser]
you have an extra period in your CONCAT_WS that is producing this in the sql:
users.first_name.users.last_name

should be users.first_name, users.last_name
#9

[eluser]xtremer360[/eluser]
Code:
$this->db->select("CONCAT_WS(' ', ".$this->master_model->users_table.".first_name", $this->master_model->users_table.".last_name) AS author", FALSE);

Tried this and I'm still getting a syntax error.




Theme © iAndrew 2016 - Forum software by © MyBB