471,063 Members | 2,255 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,063 software developers and data experts.

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

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.


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

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


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 2254
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
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
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
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
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.