User Profile

Collapse

Profile Sidebar

Collapse
KevinUK
KevinUK
Last Activity: Aug 3 '06, 02:03 PM
Joined: Aug 2 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • KevinUK
    replied to Returning data from functions?
    in PHP
    Well I've done it, is there any optimisation I can do on the class that calls the method though? Seems like I could narrow down the code needed.

    [PHP]
    $result = lists::comments (3);

    while ($row = mysql_fetch_ass oc($result)) {

    echo $row['title'];
    echo $row['comment'] . "<br/>";
    }[/PHP]
    See more | Go to post

    Leave a comment:


  • KevinUK
    replied to Returning data from functions?
    in PHP
    Oh that function is a mess, its now:

    Code:
    function comments($number) {
    	
    		$query = "SELECT id,title,comment FROM comment ORDER BY id DESC LIMIT $number";
    		$result = @mysql_query($query) or die('No ID found');
    	
    		while ($row = mysql_fetch_assoc($result)) {
    		
    			echo $row['title'] . " ";
    			echo $row['comment'] . "<br/>";
    ...
    See more | Go to post

    Leave a comment:


  • KevinUK
    started a topic Returning data from functions?
    in PHP

    Returning data from functions?

    Hi, I have this function which currently outputs the data but I would like the class calling this function to handle the output instead. How do I go about doing that?

    Code:
    function comments($number) {
    	
    		$query = "SELECT id,title,comment FROM comment ORDER BY id DESC";
    		$result = @mysql_query($query) or die('No ID found');
    				
    		$count = 0;
    		
    		while (($row = mysql_fetch_assoc($result))
    ...
    See more | Go to post
    Last edited by KevinUK; Aug 2 '06, 01:53 PM.
No activity results to display
Show More
Working...