while loop - PHP: Whileloop return all rows -


i having trouble in returning rows while loop. when checking print_r($item) it's returning rows when user return in while loop returning first row. think because return loop @ first time.

so how can return rows.. here trying

while($item = db_assoc($query)){      return '<p>'.$item['title'].'</p>'; } 

the while loop within class method , have return value can't use echo

thanks lot....

like say, you're returning after first row. try following:

$output = '';  while ($item = db_assoc($query)) {     $output .= "<p>{$item['title']}</p>"; }  return $output; 

Comments

Popular posts from this blog

How to logout from a login page in asp.net -

Stack level too deep error after upgrade to rails 3.2 and ruby 1.9.3 -