Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/87161-solved-search-multiple-db-fields/
Share on other sites

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

 

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.