View Full Version : mysql_fetch_array in a function

09-18-2005, 03:25 AM
I'm stuck, i made a function that gets the news from the database, and it is supposed to get 4 last rows of the database, and then after i print it is suppose to output 4 last results, but it doesn't it ouputs only one...

function news(){
$newsdb="SELECT*FROM news order by id";
$getnews=mysql_query($newsdb) or die(mysql_error());
$newsboard="$title <br /> $body <br />$writter <br /> \n $time <br /> \n<a href=\"$self?nid=$id\">comments</a><br />";
return $newsboard;

and they i print it

print news();

Can u tell me where is the mistake...

It seems that it returns the first thing that it gets in $newsboard var... but how to make so it takes all the rows ???

09-18-2005, 04:28 AM
$newsboard .= "etc, note the '.' (dot)";

09-18-2005, 04:32 AM
wow, thanks firepages, your help was brilliant and simple!
i've tried everything but i had to put only 1 dot, brilliant, lol,

Me stupid :p