By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,949 Members | 1,869 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,949 IT Pros & Developers. It's quick & easy.

Php searching mysql within a string

P: 4
I have a string of a user's domain name say

my.long.domain.com

I have a MYSQL statement set-up to match using the SQL statement below.

SELECT * FROM {emaildomains} WHERE domain LIKE '%$domainex%

It matches the root domain (which is in the emaildomains database works fine if I have a domain.com name but not long.domain.com or my.long.domain.com

Is there a way to match this long domain string which the user may input to the root domain in the database?

Thanks,
Lucas
Feb 21 '08 #1
Share this Question
Share on Google+
2 Replies


MarkoKlacar
Expert 100+
P: 296
Hi Lucas,

I think you need to look at explode or strtok.

Good luck.
Feb 22 '08 #2

P: 4
Thanks, I exploded the string based on each "." and then counted the number of "." to make sure I got the root minus the subdomains.

Cheers.
Feb 25 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.