473,396 Members | 1,777 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,396 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 2374
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.