lukieleetronic
lukieleetronic

Reputation: 623

MySQL Union Query not returning expected result,

MySQL query only returns the second SELECT results in the union and I have no idea why...can you plz help?

$query  = "SELECT name ";
$query .= "FROM nutrients ";
$query .= "WHERE name LIKE '%{$sqlsafe_query}%' ";
$query .= "LIMIT 30 ";
$query .= "UNION ALL ";
$query  = "SELECT name ";
$query .= "FROM supplements ";
$query .= "WHERE name LIKE '%{$sqlsafe_query}%' ";
$query .= "LIMIT 30";

Upvotes: 0

Views: 55

Answers (1)

Paco Abato
Paco Abato

Reputation: 4065

$query  = "SELECT name ";

Are you lack of the . before the =?

Upvotes: 1

Related Questions