Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing A Variable 1

Status
Not open for further replies.

danima

Programmer
Jan 9, 2002
134
0
0
CA
Hi folks:

I'll apologize in advance for my question. I'm not a programmer like most of you. I get buy (some cutting, pasting, modifying)...but I have great programmers to do our work. Problem is they are all busy and I think I bit off a bit more than I can chew on one of our projects.

We are doing a site for a local hotel and they have 4 seperate packages they offer their visitors (room, wedding, meeting and social packages). In another system we have (that I moved over and started modifying) there is a function called displayPropertyPackage(). This gets called in the index file of the individual package pages. Problem is...it pulls up all of the packages (from all 4 categories). I need all 4 pages (Wedding, Room, Social and Meeting) to pull up just the packages that pertain to that group. So, I modified the query as follows:

$sqlquery = "
SELECT * FROM package_groups
WHERE package_group_display = 1 and package_group_id = 2
ORDER BY package_group_order ";

I added the "and package_group_id = 2"

Of course, this just brings the Room categories up (Room is id 2). I was really proud of myself but then realized I'd have to copy the function 3 times to accomodate the other 3 package_group_id numbers. So, I asked our programmer what to do. He's busy and getting ready to go away...so, he thinks I can handle this (tee hee). He says "pass a variable to the function". "simple just add a variable in the brackets of the function called group_id"

I realize that he wants this to happen
displayPropertyPackage(something here)
... and he thinks I can handle this...I do understand it...but do not know how to execute it...

I'm just not certain how to write this...and he's out of town for the next few days....and I'm in a bind. Any help would...well, helpful.

Thanks in advance.

 
You would need to show us what displayPropertyPackage() function does. And what exactly do you want to do. Based on the description, you would need change the function to be:
Code:
function displayPropertyPackage($arg)
{
...
$sqlquery = "
SELECT * FROM package_groups
WHERE package_group_display = 1 and package_group_id = " . $arg . "
ORDER BY package_group_order ";
...
}
And call your function via displayPropertyPackage(2), displayPropertyPackage(3), etc.
 
It's a pretty long function. How should I send it? Just post it? Or send a link to a file?
 
How did you add the CODE to your post?
 
Wow...disregard the above post....your answer did the trick. Thank you very, very much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top