Question

I am currently creating a website for one of my clients using Joomla. I am still able to access the administration side of the website, however, when the user views the website, I am presented with this error.

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 'ORDER BY content.created DESC' at line 28

    SELECT 
  content.id AS iid,
  content.access AS access,
  categories.title AS catname,
  users.email AS author_email,
  content.created_by_alias AS author_alias,
  content_rating.rating_sum AS rating_sum,
  content_rating.rating_count AS rating_count,
  CASE
    WHEN CHAR_LENGTH(content.alias) 
    THEN CONCAT_WS(":", content.id, content.alias) 
    ELSE content.id 
  END AS id,
  CASE
    WHEN CHAR_LENGTH(categories.alias) 
    THEN CONCAT_WS(
      ":",
      categories.id,
      categories.alias
    ) 
    ELSE categories.id 
  END AS cid 
FROM
  xg6zxarh4_jos_content AS content 
  LEFT JOIN xg6zxarh4_jos_categories AS categories 
    ON categories.id = content.catid 
  LEFT JOIN xg6zxarh4_jos_users AS users 
    ON users.id = content.created_by 
  LEFT JOIN xg6zxarh4_jos_content_rating AS content_rating 
    ON content_rating.content_id = content.id 
WHERE 
ORDER BY content.created DESC

I have tried repairing the tables in Joomla and PHPmyAdmin but to no avail. What could be the problem?

Was it helpful?

Solution

Your WHERE clause is empty.

LEFT JOIN xg6zxarh4_jos_content_rating AS content_rating 
    ON content_rating.content_id = content.id 
WHERE <-- HERE
ORDER BY content.created DESC

Either add a condition (even WHERE 1=1 will do) or remove it altogether.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top