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

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

java - More than one row with the given identifier was found: 1, for class: com.model.Diagnosis -