| | |
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
Views: 926 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access address ajax apache api array autoincrement beginner binary broken cakephp checkbox class cms code cron curl database date dehasher directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail menu method methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql structure support! syntax system table tutorial update updates upload url validation validator variable video web xml youtube





