943,929 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1577
  • PHP RSS
Sep 8th, 2008
0

calling function name? i need help

Expand Post »
Quote ...
hi;

please help to check this code. i have a fucntion name to use in my select dropdown list, and I problem in calling the the function name;

here is the whole code of my function.
function getAllR($Region_id) {
		//returns an array with city info
		$query="SELECT * FROM cityinfo where Region_index='$Region_id'";
		$result=mysql_query($query);
		if (!$result)
			return false;
		else {
			$i=0;
			$returnArray=array();
			while ($row=mysql_fetch_array($result)) {
				$returnArray[$i]=new city();
				$returnArray[$i]->City_id=$row['City_id'];
				$returnArray[$i]->Region_index=$row['Region_index'];
				$returnArray[$i]->displayName=$row['City_name'];
				$i++;
			}	
			return $returnArray;	
		}
	}

here the whole code of my dropdown list

$cities=region::getAllR();
					if (!isError($cities)){
						foreach ($cities as $element => $value) {
							echo '<option value="'.$value->City_id.'"';
							if ($value->City_id=='$city')
								echo ' selected="selected"';
							echo '>'.$value->displayName.'</option>';
						}
					}
				}
Quote ...
what is wrong in this code? why it does not display the item for the dropsown list?

please i need your help, thanks advance
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
god_1896 is offline Offline
39 posts
since Jul 2008
Sep 8th, 2008
0

Re: calling function name? i need help

Just taking a quick look, you have not passed in a parameter to the region::getAllR() call. Note that the signature of the function is function getAllR($Region_id) which contains a single parameter with no default value set. Therefore you must call the function like so: region::getAllR($aRegionId);
Reputation Points: 395
Solved Threads: 192
Veteran Poster
darkagn is offline Offline
1,136 posts
since Aug 2007
Sep 8th, 2008
0

Re: calling function name? i need help

Click to Expand / Collapse  Quote originally posted by darkagn ...
Just taking a quick look, you have not passed in a parameter to the region::getAllR() call. Note that the signature of the function is function getAllR($Region_id) which contains a single parameter with no default value set. Therefore you must call the function like so: region::getAllR($aRegionId);
thanks, I am going to try it
Reputation Points: 10
Solved Threads: 0
Light Poster
god_1896 is offline Offline
39 posts
since Jul 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: file_get_contens doesn`t work
Next Thread in PHP Forum Timeline: turning on warnings in PHP





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC