| | |
calling function name? i need help
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2008
Posts: 39
Reputation:
Solved Threads: 0
•
•
•
•
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>';
}
}
}•
•
•
•
what is wrong in this code? why it does not display the item for the dropsown list?
please i need your help, thanks advance
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);
There are no stupid questions, only those too stupid to ask for help.
echo is a web developer's best friend. •
•
Join Date: Jul 2008
Posts: 39
Reputation:
Solved Threads: 0
•
•
•
•
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);
![]() |
Similar Threads
- Helping with calling a function (C)
- Calling C function from MATLAB (C)
- Calling function to add HTML to the page (ASP.NET)
- Function call problem (HTML and CSS)
- Still need info on calling a function from bool! (C++)
- How would i recode as a function? (Java)
- Function that returns void (C++)
Other Threads in the PHP Forum
- Previous Thread: file_get_contens doesn`t work
- Next Thread: turning on warnings in PHP
| Thread Tools | Search this Thread |
5.2.10 action apache api array beginner beneath binary broken cakephp checkbox class classes cms code cron curl database date destroy display dynamic echo echo$_get[x]changingitintovariable... email encode error fcc file files folder form forms function functions google header howtowriteathesis href htaccess html image images include insert ip javascript joomla limit link local login mail memberships menu mlm mod_rewrite multiple multipletables mysql mysqlquery neutrality oop open passwords paypal pdf php provider query radio random record remote rss script search server sessions sockets source space sql strip_tags syntax system table template thesishelp tutorial update upload url validator variable video voteup web window.onbeforeunload=closeme; youtube





