How to use a return from a function?
<p>I have a while loop in my content.php and I want to use $result like a parameter. How can i call a function from content.php file and get $result to use in my while loop?</p>

<pre><code>  while ($row = mysql_fetch_array($result)) 
                {
                    $ename = stripslashes($row['name']);
                    $eemail = stripslashes($row['email']);
                    $ebox = stripslashes($row['lund']);
                    $ecategori = stripslashes($row['LundaBlogg']);
                    $epost = stripslashes($row['post']);
                    $grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=".md5(strtolower($eemail))."&amp;size=70";

                    echo
                    (
                        '&lt;li&gt; 
                            &lt;div class="datum"&gt;'.$row['date'].'&lt;/div&gt;
                            &lt;div class="meta"&gt;&lt;img src="'.$grav_url.'" alt="Gravatar" /&gt;&lt;p&gt;'.$ename.'&lt;/p&gt;&lt;/div&gt;
                            &lt;/br&gt;
                            &lt;div class="categori"&gt;&lt;p&gt;Kategori: '.$ecategori.'&lt;/p&gt;&lt;/div&gt;
                            &lt;div class="topic"&gt;&lt;p&gt;'.$ebox.'&lt;/p&gt;&lt;/div&gt;   
                            &lt;div class="shout"&gt;&lt;p&gt;'.$epost.'&lt;/p&gt;&lt;/div&gt;
                            &lt;div class="raderaknapp"&gt;&lt;a href="../delete_ac.php?id=' . $row['id'] . '"class=\"icon-2 info-tooltip\"&gt;Radera Inlägg&lt;/a&gt;&lt;/div&gt;
                            &lt;div class="raportpost"&gt;&lt;p&gt;&lt;a href="mailto:someone@example.com?Subject=Hello%20again"&gt;Rapportera inlägg&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
                        &lt;/li&gt;'
                    );

                    ?&gt;
                        &lt;h4&gt;
                        &lt;form action="&lt;?php echo $self?&gt;" method="POST"&gt;
                            &lt;input type="hidden" name="id" value="&lt;?php echo $row['id']?&gt;"/&gt;
                            &lt;input type = "submit" name="Gilla" value = 'Gilla'"/&gt;
                        &lt;/form&gt;
                        &lt;/h4&gt;

                        &lt;div id="radera-infotwo"&gt;
                            &lt;span onmouseover="ShowText('Messagetwo'); return true;" onmouseout="HideText('Messagetwo'); return true;" href="javascript:ShowText('Messagetwo')"&gt;
                                &lt;img src="http://www.wallpaperama.com/forums/post-images/20081107_6718_question-mark.gif"&gt;
                            &lt;/span&gt;
                        &lt;/div&gt;  

                        &lt;div id="radera-info"&gt;
                            &lt;span onmouseover="ShowText('Message'); return true;" onmouseout="HideText('Message'); return true;" href="javascript:ShowText('Message')"&gt;
                                &lt;img src="http://www.wallpaperama.com/forums/post-images/20081107_6718_question-mark.gif"&gt;
                            &lt;/span&gt;
                        &lt;/div&gt;

                        &lt;?
                        ?&gt;
                    &lt;?

                    echo ("Antal Gilla: " .$row['likes']); 

                    if(isset($_POST['Gilla']) &amp;&amp; $_POST['id'] == $row['id']){echo '&lt;h5&gt;&lt;img src="../images/tummen-upp.png"/&gt;Du har Gillat detta inlägg.&lt;/h5&gt;';}

                    echo "&lt;hr&gt;";  
                }   
</code></pre>

<p>This is my functions.php file where I have my function blogPosts_get()</p>

<pre><code>function blogPosts_get(){ 
  $query = "SELECT * FROM shouts ORDER BY `id` DESC LIMIT 8;";
  $result = mysql_query($query) or die('&lt;p class="error"&gt;Wrong.&lt;/p&gt;');   
}
</code></pre>

<p>I have tried with a return in my function blogPosts_get(), but I can not understand how its work. Can somebody help me get the $result variabel from my function blogPosts_get() so I can use It in my while loop?</p>
