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

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

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

Similar topics

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 =...
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...
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...
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...
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...
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...
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:...
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...
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...
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...
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...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
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...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
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.