473,375 Members | 1,200 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 2372
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

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

Similar topics

16
by: Jeff Wagner | last post by:
I am trying to rewrite an old program written in VB. I can't figure out how to do the following: if SumOfNumbers == 11 or SumOfNumbers == 22 or SumOfNumbers == 33: return else: I2 =...
6
by: Christian Seberino | last post by:
I am looking at the ELSE home page and trying to figure out if I should invest the time to learn about the ELSE minor mode for Emacs. Is there any programmer out there using ELSE that is getting...
27
by: Ron Adam | last post by:
There seems to be a fair amount of discussion concerning flow control enhancements lately. with, do and dowhile, case, etc... So here's my flow control suggestion. ;-) It occurred to me (a...
2
by: Tank | last post by:
I am trying to incorporate a count into a variable within an if...else statement. Here is the code. I cant get it to work. perhaps someone can assist me. folder = window.prompt('starting...
19
by: GMKS | last post by:
Hello all, I have 13 check boxes on a form. I am trying to check all the check boxes to determine if they are true or false when I close the form. At present only the first IF...Then...Else...
3
by: PrinceMhul | last post by:
I have multiple functions that I am trying to get to work based on what my textbox says. If the textbox says "1" then I want the function "revealit1()" to be called. If it says 2, I want...
17
by: JRough | last post by:
I'm trying to get error proof code. I have this code which seems to work but now I look at it I think it should be elseif not else and I wonder why it works. It is in the block:...
7
by: jeddiki | last post by:
Hi, As I am in Turkey at present, I can not see vidoes on youtube. So I have tried a few proxies but keep finding them slow or not working. So I have installed myphpProxy on my server under...
5
by: Merdina | last post by:
In the interest of full disclosure, I must admit that this is the first time I have ever tried using Access, let alone worked with VB. I came up with an idea for an access database that will help me...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.