how can i fix this on php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ppicasso
Forum Newbie
Posts: 1
Joined: Sat Jul 18, 2015 8:00 am

how can i fix this on php

Post by ppicasso »


Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 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 'FROM topics INNER JOIN categories ON topics.category_id = categori' at line 1' in C:\xampp\htdocs\talkingspace\libraries\Database.php:60 Stack trace: #0 C:\xampp\htdocs\talkingspace\libraries\Database.php(60): PDOStatement->execute() #1 C:\xampp\htdocs\talkingspace\libraries\Database.php(64): Database->execute() #2 C:\xampp\htdocs\talkingspace\libraries\Topic.php(43): Database->resultset() #3 C:\xampp\htdocs\talkingspace\topics.php(15): Topic->getByCategory('1') #4 {main} thrown in C:\xampp\htdocs\talkingspace\libraries\Database.php on line 60
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: how can i fix this on php

Post by Celauran »

Would be helpful to see the query in question.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: how can i fix this on php

Post by Christopher »

Yes, the SQL would be helpful. My wild guess is that it your are not using table.field format in your field list while doing a join, given that the error is near 'FROM topics INNER JOIN categories ON topics.category_id = categori'
(#10850)
Post Reply