desithugg Posted April 28, 2007 Share Posted April 28, 2007 <? function get_shoutz($user,$start,$limit) { if($start=="") { $start="0"; } if($limit=="") { $limit="5"; } $query = "SELECT * FROM shoutz where owner='$user' limit $start,$limit"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){$count++; $poster = $row["poster"]; $dst = $row["date"]; $shout = $row["shout"]; $whole_thing "<b>".$poster."</b><br>".$dst."<br>"."<div class='shout'>".$shout."</div>"; } } get_shoutz("1","",""); ?> Umm what it does is fetches rows from a table called shoutz depending on the start and limit variables. So in this case it would use the defauly 0 for start and 5 for limit. anyways the rows are being fetched in a loop what I want to do is combine all the 5 rows fetched in to one variable like $shotbox and than use return $shoutbox; at the end of the function so where ever i put get_shouts("1","",""); it will show the whole thing. Sorry if i'm confusing. not sure how to say it. Quote Link to comment https://forums.phpfreaks.com/topic/49038-php-function-with-loop-query/ Share on other sites More sharing options...
MadTechie Posted April 28, 2007 Share Posted April 28, 2007 erm.. you didn't really tell the problem Quote Link to comment https://forums.phpfreaks.com/topic/49038-php-function-with-loop-query/#findComment-240238 Share on other sites More sharing options...
desithugg Posted April 28, 2007 Author Share Posted April 28, 2007 lol woops sorry, ignore the post i kinda figured it out. Quote Link to comment https://forums.phpfreaks.com/topic/49038-php-function-with-loop-query/#findComment-240240 Share on other sites More sharing options...
MadTechie Posted April 28, 2007 Share Posted April 28, 2007 can you click solved then please Quote Link to comment https://forums.phpfreaks.com/topic/49038-php-function-with-loop-query/#findComment-240251 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.