|
Posted by Peter van Schie on 10/07/05 10:02
Siv Hansen wrote:
> then I have my "main"-page, where I try to make a function
> listSections()- like this:
> function listSections(){
> $sections = $connector->query("select * from section");<-- line 27
> while($result= $connector->fetchArray($sections)){
> print("<option>".$result['name']."</option>\n");
> }
> }
Hi Siv,
This seems like a scope problem to me. Where do you create the
$connector object? If it's outside of the function listSections, it
really is a scope problem.
If you created it in the same script where listSections resides (or in a
script that includes the php file containing the definition of
listSections, you could try:
function listSections(){
global $connector;
$sections = $connector->query("select * from section");
while($result= $connector->fetchArray($sections)){
print("<option>".$result['name']."</option>\n");
}
}
Peter.
--
http://www.phpforums.nl
Navigation:
[Reply to this message]
|