Firefox PHP

Adding a array_push to a function

Posted by Carl 
Adding a array_push to a function
September 17, 2004 03:24PM
Hi there,

I have just been put in charge of this project and i am learning PHP..
the query seems to work however when i added the array_push to yield the pull down results it broke.. please take a look at the syntax... thnx

function traversePages($thePageID,$theLevel) {
global $adminapp;
$processChildren = false;
// grab page information
$pageQuery = "SELECT * FROM pages WHERE PageID = " . $thePageID;
$rs = $adminapp->dwdatabase->Query($pageQuery);

if($rs->fields['Approval'] == 100) {
$spacer = "";
if($theLevel > 1) {
$spacer = str_repeat(" ",$theLevel);
}
$pageName = $spacer . $rs->fields['PageName'];
array_push($this->allPagesArray,DWAT_utils::encodePageID($thePageID)."\t".$pageName);
}


if($rs->RecordCount() < 1) {
return 0;
}


$subQuery = "SELECT * FROM Pages WHERE PageID = " . $rs->fields['ChildPage'];
$subRs = $adminapp->dwdatabase->Query($subQuery);
if($subRs->RecordCount() > 0) { // look for child pages
$this->traversePages($subRs->fields['PageID'],$theLevel+1);
}

if($rs->fields['UpSiblingPage'] == 0) { // look for pages on same level
return 0;
} else {
if($thePageID == $rs->fields['UpSiblingPage']) {

return 0;
} else {
$this->traversePages($rs->fields['UpSiblingPage'],$theLevel);
}
}
}
Re: Adding a array_push to a function
September 17, 2004 03:41PM
Sorry i am in the wrong place...
Sorry, you do not have permission to post/reply in this forum.