bigleo23 Posted January 22, 2008 Share Posted January 22, 2008 I have a small problem that should be simple to fix, I am programming my site with dreamweaver since I don't know programming lang. yet. I am building a search results page and since I don't know php I am having trouble with the where statement, all I want is to search 5 0r 6 fields in the same table for the url variable. if someone could help me with what I am suppose to put in the where, in dreamweaver I would greatly appreciate it. Thank You Quote Link to comment https://forums.phpfreaks.com/topic/87161-solved-search-multiple-db-fields/ Share on other sites More sharing options...
toplay Posted January 22, 2008 Share Posted January 22, 2008 SELECT * FROM table_name WHERE col1 = 'something' OR col2 = 'something' OR col3 = 'something' OR col4 = 'something' OR col5 = 'something' MySQL select syntax page: http://dev.mysql.com/doc/refman/5.0/en/select.html Quote Link to comment https://forums.phpfreaks.com/topic/87161-solved-search-multiple-db-fields/#findComment-445810 Share on other sites More sharing options...
bigleo23 Posted January 22, 2008 Author Share Posted January 22, 2008 I am truly sorry toplay, but could you explain a little bit more please? Quote Link to comment https://forums.phpfreaks.com/topic/87161-solved-search-multiple-db-fields/#findComment-445852 Share on other sites More sharing options...
beebum Posted January 22, 2008 Share Posted January 22, 2008 With the "OR" only one of the columns needs to match the "something" in order to return the row. A returned row could have had a match on more than one column. Keep in mind that with the "=" it must be an exact match. Otherwise you must use "LIKE" instead of "=" or create a fulltext index across the columns. Quote Link to comment https://forums.phpfreaks.com/topic/87161-solved-search-multiple-db-fields/#findComment-446126 Share on other sites More sharing options...
bigleo23 Posted January 22, 2008 Author Share Posted January 22, 2008 OK so how do I set this up, I imagine I have to declare a variable for each of the fields that I want to search (col1 = 'something'). how would I set this up in dream weaver? The variable box asks for name default value and run time value? Quote Link to comment https://forums.phpfreaks.com/topic/87161-solved-search-multiple-db-fields/#findComment-446288 Share on other sites More sharing options...
bigleo23 Posted January 23, 2008 Author Share Posted January 23, 2008 I would like to thank everybody who helped me!!!!! Hopefully I can help you out one day!! Quote Link to comment https://forums.phpfreaks.com/topic/87161-solved-search-multiple-db-fields/#findComment-446626 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.