PHP mysql recursive function array_unshift -


i have problem recursive function in php. call function , row database, put row array , call function again other rows, conected row... problem is, array_unshift save first row , other not. problem. thank answers.

    public static function nahrejzpravy($responsetable, $responseid){     $return = array();     $query = "select * zpravy responsetable = '$responsetable' , responseid = '$responseid'";     $result = query($query);     while($row = mysql_fetch_assoc($result)){         array_unshift($return, $row);         zpravy::nahrejzpravy('zpravy', $row['id']);     }       return $return; } 

<?php  function getresponsesrecursive($responsetable, $responseid) {     $responses = array();     $query = "select * zpravy responsetable = '$responsetable' , responseid = '$responseid'";     $result = mysql_query($query);     while ( $row = mysql_fetch_assoc($result) ) {         $row['responses'] = getresponsesrecursive($row['table'], $row['id']);         $responses[] = $row;     }     return $responses; } ?> 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -