FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


* as a wildcard





DjMilez
Is it possible to use * as a wildcard for determining if a variable contains a certain word or number? I have attempted to do this but it didn't work, but then again I never do anything right.
Peterssidan
Are you talking about PHP or MySQL? Is it important that it have to be the * or is it just what you believe?

In MySQL you can do like this to get the rows where 'variable' contains the character m.
Code:
SELECT * FROM table WHERE variable LIKE '%m%'
rvec
in php use strstr()
kv
strstr does not have support for wildcards. use preg_match instead. http://php.net/preg_match
rvec
Quote:
if a variable contains a certain word or number?

that can be done with strstr(), if you really need wildcards then yeah you'll have to use preg_match and there (.*) will act like a wildcard.
DjMilez
Ok, thanks for replying.
Related topics
wildcard subdomains?
How post picture in the forum?
mIRC for begginers.
SQL Basics
Creating an RPG bot in IRC (yes I wrote this)
Boston Red Sox Clinch Wildcard!!!
Hide Part of Your Web Site from Yahoo!
Help with PhpBB
ExplorerXP
Best FTP Client on EARTH
Tennis Season Winds Up Again...
WildCard
WildCard
wildcard subdomains
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.