Jump to content

[SOLVED] Function Call ?


ainoy31

Recommended Posts

Hello-

 

I am running into an issue where I am making a function call multiple times.  So, I have say function X that accepts a parameter.  This function X is in a different directory from where I am making a call.

 

OK.  I make the first call to function getProductName and pass it a parameter.

$prodID = 1;
$data = $obj->getProductName($prodID);

public function getproductName($id)
{
    this takes the id that was passed in and returns the product name
}

 

Then, I make a second call to the same function but with a different product id

$prodID = 49;
$data = $obj->getProductName($prodID);

public function getproductName($id)
{
    this takes the id that was passed in and returns the product name
}

 

The issue I am facing is that on the second call to the getProductName function, it is using the value 1 from the first call rather than the value of the second call of 49.  Then it returns the same product name as the first call.  I hope this is clear to understand.  I can not understand why this is happening.  Maybe I am making this harder that it seems.  Much appreciation.  AM

Link to comment
https://forums.phpfreaks.com/topic/134128-solved-function-call/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.