I have a PHP document which will execute some MySQL and echoes it back.
Code:
$query1 = "SELECT * FROM feed, recipients WHERE feed.title LIKE \"%recipients.suburb%"\ ORDER BY pubDate DESC";
recipients.suburb (table.column) is in my MySQL DB. How can I perform wildcards on this?
This works, but I can't do it for tables?
$query1 = "SELECT * FROM feed, recipients WHERE feed.title LIKE '%test%' ORDER BY pubDate DESC";
I'd like to check the column feed.title
and see if any of this text is in recipients.suburb
. It is for a script that will eventually email users, based on text from MySQL co-relating to the location of the user.
Try:
SELECT *
FROM feed, recipients
WHERE feed.title LIKE concat('%', recipients.suburb, '%')
ORDER BY pubDate DESC