Hey, I'm very new to PHP and just started messing with a site that would allow someone to download files from it. On the form they can type in the file name and search through the SQL table for only an exact match. What I want to be able to do is take whatever they type in and bring back any file name with that in it. I don't know of any SQL function that will allow me to do that, but I easily could be wrong on that, so I was thinking maybe I need to use regular expressions? I tried a few things with regular expressions, but I really didn't understand what I was doing with it.
If you need any examples of what I mean, I can try to be more specific. Any help would be greatly appreciated, thanks!
partial sql search?
Moderator: General Moderators
Re: partial sql search?
Use LIKE:
% is a wildcard, basically.
Code: Select all
SELECT * FROM table WHERE field LIKE "%text%"Re: partial sql search?
Ah, that's what I was looking for. Thanks that worked perfect!