calling a function from another function
Posted: Tue Jan 26, 2010 11:49 am
i got a problem while calling a function from another function. the code runs like this.
function get_all($agcode){
global $connection;
$query="SELECT * FROM agdb WHERE agentcode={$agcode}";
$result=mysql_query($query, $connection);
confirm_query($result);
while($row=mysql_fetch_array($result)){
$agent_name=$row['agentname'];
$agent_eligible_code=$row['agencyeligcode'];
$dobyear=$row['dobyear'];
$dobmonth=$row['dobmonth'];
$dobdate=$row['dobdate'];
$pannumber=$row['pannumber'];
$dev_off_code=$row['devoffcode'];
}
}
function get_age($agcode){
get_all($agcode);
$dob=$dobmonth ."/". $dobdate."/".$dobyear;
return $dob;
}
and the error message is there is an undifined variables called $dobmonth, $dobdate, $dobyear for linenumbers corresponding to second function. Hence Please help me where i have gone wrong.
function get_all($agcode){
global $connection;
$query="SELECT * FROM agdb WHERE agentcode={$agcode}";
$result=mysql_query($query, $connection);
confirm_query($result);
while($row=mysql_fetch_array($result)){
$agent_name=$row['agentname'];
$agent_eligible_code=$row['agencyeligcode'];
$dobyear=$row['dobyear'];
$dobmonth=$row['dobmonth'];
$dobdate=$row['dobdate'];
$pannumber=$row['pannumber'];
$dev_off_code=$row['devoffcode'];
}
}
function get_age($agcode){
get_all($agcode);
$dob=$dobmonth ."/". $dobdate."/".$dobyear;
return $dob;
}
and the error message is there is an undifined variables called $dobmonth, $dobdate, $dobyear for linenumbers corresponding to second function. Hence Please help me where i have gone wrong.