ballhogjoni Posted October 20, 2008 Share Posted October 20, 2008 I have setup a form for the user to search my db for a term but, I don't know how to search all table in my db for the keyword. My code only works for one table: SELECT * FROM `Articles` WHERE (`title` REGEXP CONVERT(_utf8 'credit cards' USING latin1) COLLATE latin1_swedish_ci OR `tinymcedata` REGEXP CONVERT(_utf8 'credit cards' USING latin1) COLLATE latin1_swedish_ci OR `author_id` REGEXP 'credit cards' OR `topic_id` REGEXP 'credit cards' OR `display_on_home_page` REGEXP 'credit cards' OR `publish_date` REGEXP 'credit cards' OR `meta_title_addition` REGEXP CONVERT(_utf8 'credit cards' USING latin1) COLLATE latin1_swedish_ci OR `meta_description_addition` REGEXP CONVERT(_utf8 'credit cards' USING latin1) COLLATE latin1_swedish_ci OR `meta_keywords_addition` REGEXP CONVERT(_utf8 'credit cards' USING latin1) COLLATE latin1_swedish_ci) Can anyone show me how to search the entire db for the keyword? Link to comment https://forums.phpfreaks.com/topic/129235-how-do-i-search-my-db/ Share on other sites More sharing options...
sageauk Posted October 20, 2008 Share Posted October 20, 2008 try this maybe it might help you http://dev.mysql.com/doc/refman/5.0/en/union.html Link to comment https://forums.phpfreaks.com/topic/129235-how-do-i-search-my-db/#findComment-670017 Share on other sites More sharing options...
ballhogjoni Posted October 20, 2008 Author Share Posted October 20, 2008 I setup a union select but now I get an error that says: The used SELECT statements have a different number of columns Each table has different amount of colums, how do I get around this error? Link to comment https://forums.phpfreaks.com/topic/129235-how-do-i-search-my-db/#findComment-670087 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.