468,737 Members | 2,469 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,737 developers. It's quick & easy.

cPath if, else - help - Trying to use WILDCARRD, cPath

5
I am very new to PHP hopefully someone can help me I am trying to use a wildcard for a simple "if else" code. I cant seem to figure out how to do this.

e.g.

if($cPath == '1')
{
echo "this table";
}

I am trying to get it so that cPath will display all categories with the number 1

(e.g.
1_1
1_2
1_3
etc)

I’m not sure how I would go about doing this or how to use a wildcard method any help would be great!
Jul 18 '06 #1
4 2176
iam_clint
1,208 Expert 1GB
can you give us more of the code and where your having the problem what is cpath set to so on.
Jul 18 '06 #2
l!m!t
5
Sure I will try and explain.

cPath is the category ID (eg say I have a page called books cPath would be index.php?cPath=1_16 I only want the categories with 1_XX to show so anything with 2_XX - X_XX shouldn’t show. I was thinking a wildcard method would work just not sure how I would go about doing it.

Thanks for the help!
Jul 18 '06 #3
iam_clint
1,208 Expert 1GB
alright as to a wild card theres not really a way i can think of todo it like your trying
substr(cpath, 0, 2) would return 1_ so you could do an if statement to make sure that the left 2 characters of that string is 1_ but you will need to make a loop to have it check each one.
Jul 18 '06 #4
l!m!t
5
I found a way I just used a greater/ lesser range (eg if ($cPath > '1' && $cPath < "1_99")

looks to work thus far.

Thanks for the help!
Jul 18 '06 #5

Post your reply

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

Similar topics

16 posts views Thread by Jeff Wagner | last post: by
6 posts views Thread by Christian Seberino | last post: by
27 posts views Thread by Ron Adam | last post: by
2 posts views Thread by Tank | last post: by
19 posts views Thread by GMKS | last post: by
3 posts views Thread by PrinceMhul | last post: by
17 posts views Thread by JRough | last post: by
1 post views Thread by CARIGAR | last post: by
xarzu
2 posts views Thread by xarzu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.