conker87 Posted June 13, 2008 Share Posted June 13, 2008 I'm trying to make a search form for my site. Just a quick question. This is my query: $query = "SELECT * FROM `articles`, `reviews` WHERE `articles`.`title` LIKE '%$search%' OR `articles`.`author` LIKE '%$search%' OR `articles`.`type` LIKE '%$search%' OR `articles`.`content` LIKE '%$search%' OR `reviews`.`title` LIKE '%$search%' OR `reviews`.`genre` LIKE '%$search%' OR `reviews`.`platform` LIKE '%$search%' OR `reviews`.`author` LIKE '%$search%' OR `reviews`.`content` LIKE '%$search%'"; Where '$search' is the escaped query. Will this work? And can I use it with mysql_fetch_array/assoc? Link to comment https://forums.phpfreaks.com/topic/110027-search-site/ Share on other sites More sharing options...
RMcLeod Posted June 13, 2008 Share Posted June 13, 2008 $query = "SELECT * FROM `articles`, `reviews` WHERE articles.title LIKE '%$search%' OR articles.author LIKE '%$search%' OR articles.type LIKE '%$search%' OR articles.content LIKE '%$search%' OR reviews.title LIKE '%$search%' OR reviews.genre LIKE '%$search%' OR reviews.platform LIKE '%$search%' OR reviews.author LIKE '%$search%' OR reviews.content LIKE '%$search%'"; No need for the ` when you referencing a table and column using table.column syntax. If you're doing a content search I would recommend you look into using MySQL's Full Text capabilities. Link to comment https://forums.phpfreaks.com/topic/110027-search-site/#findComment-564648 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.