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]
User Profile
Collapse
-
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/>";Leave a comment:
-
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))Last edited by KevinUK; Aug 2 '06, 01:53 PM.
No activity results to display
Show More
Leave a comment: