Closed Thread Icon

Topic awaiting preservation: like Pages that link to <a href="https://ozoneasylum.com/backlink?for=25605" title="Pages that link to Topic awaiting preservation: like" rel="nofollow" >Topic awaiting preservation: like\

 
Author Thread
EDDII
Bipolar (III) Inmate

From:
Insane since: May 2004

posted posted 04-25-2005 15:32

yo im using php like command or whatever and i want to know if i can use if for multiple feild in a searchfor example if i wanted to search for any row containing dat at the moment i would go
SELECT * FROM `table` WHERE colum LIKE '%search%'
and that would only find results with 'search' in the 'colum' colum wheras i would like it to look into all of the colums to see if any of them contained the search, somthing like
SELECT * FROM `table` WHERE * LIKE '%search%'
exept that it works

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 04-25-2005 16:01

totally.


quote:
yo im using php like command or whatever



"or whatever"?

To my knowledge, the only way to do this is to use OR statements, and specify each column that you want to search.

ie -

SELECT * FROM table WHERE column1 LIKE %search% OR column2 LIKE %search% etc....

Though I'd be curious why you need to search this way - seems like there should be better ways to set up your DB


also, FWIW, the SELECT statement and anything involved in it (including 'LIKE') is SQL.



(Edited by DL-44 on 04-25-2005 16:02)

EDDII
Bipolar (III) Inmate

From:
Insane since: May 2004

posted posted 04-25-2005 16:10

the "whatever" was beacause i came on here the other day with a post and called somthing a command rather than a function or somthing like that and sum guy came on and started spitting hairs even though it dosent really matter if i know what im doing and he know what im doing
but thanks man

but i dont get what you meant by

quote:
also, FWIW, the SELECT statement and anything involved in it (including 'LIKE') is SQL.


if you wer explaining to me that it is SQL the languange thanks but is there somthing else u meant by it or did u just say it in case i dindt?

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 04-25-2005 20:59

You may also consider this simply 'splitting hairs', but you stated you were working with the PHP command 'LIKE'. But the 'LIKE' is not PHP, it is the SQL.

While the two are often used together, they are not the same and are not related to each other.

Referencing the language you are actually using goes a long way towards resolving whatever issues you may have. You can search all day for PHP and LIKE and get nowhere....whereas a search for SQL LIKE (or MySQL LIKE) will get you a great deal of helpful results.

=)

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 04-25-2005 21:24

And to continue on DL's rant, when it comes to programming you will find a ton of hair splitting. This is because the little difference are very important. This is the same reason that you will find an importance on knowing design patterns when you really get into programming. The difference between between a Singleton and a Prototype, or an Adapter or Bridge is huge, and were you to exchange one for the other you would end up with very different results.

The difference between a function and a command are huge, just as the difference between PHP and SQL are huge. If you are not using the correct diction when referring to a problem you will end up having a ton of trouble finding an accurate solution.

When I have a largish problem I would say 90% of the time I spend searching for a solution is actually figuring out what the question I should be asking. Once you have the correct diction for your question the results for your search increase in relevance substantially.

So, when the splitting hairs occurs it is because someone wants to point out that there is a better way to discuss an issue. You can't expect to get good results out of a conversation when you don't take the time to know exactly what you are talking about.

Thinking in terms of pure web design there is a huge difference between the following two questions.

"How do I set the width of a div using CSS"
"How do I set the width of a div using JavaScript"

Each of the two questions would have a plausible answer. But if I really want to know how to best set the width of my menu, the first question would be the best question to ask, and would be the easiest to answer. While were I to ask the second I would get an answer that would be way more complex than what I would even want to think about.

So, overall, I just want to point out that there hairs that are being split are often very important hairs.

Dan @ Code Town

« BackwardsOnwards »

Show Forum Drop Down Menu