I built this query, but I get a weird error, can anyone help me out please ?
$or = db_or()
->condition('title', 'test', 'LIKE')
->condition('author', 'test', 'LIKE')
->condition('service', 'test', 'LIKE')
->condition('content', 'test', 'LIKE');
$query = db_select('magazine_articles')
->condition($or)
->execute();
return $query;
PDOException: 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 magazine_articles magazine_articles WHERE ( (title LIKE ‘test’ ESCAPE ‘\” at line 1: SELECT FROM {magazine_articles} magazine_articles WHERE ( (title LIKE :db_condition_placeholder_0 ESCAPE ‘\’) OR (author LIKE :db_condition_placeholder_1 ESCAPE ‘\’) OR (service LIKE :db_condition_placeholder_2 ESCAPE ‘\’) OR (content LIKE :db_condition_placeholder_3 ESCAPE ‘\’) ); Array ( [:db_condition_placeholder_0] => test [:db_condition_placeholder_1] => test [:db_condition_placeholder_2] => test [:db_condition_placeholder_3] => test )
You haven’t specified wich fields to select, try this: