timvw wrote:Apparently you're just guessing... and hoping that things will do what you want (someday when you're lucky).
Explain us what you really want to do. Since we still haven't seen how you display something... And start reading the manual, as it explains basic stuff like iterations, loops, functions...
http://www.php.net/documentation
I have said what I want to do.
I want to be able to return a full result set from a sql query with using
a return instead of an echo.
If I wanted to return a full result set using an ECHO, I am full aware how to do it.
Code: Select all
function my_function()
{
$sql = "SELECT something FROM table";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result))
{
$display = $row['something'];
}
echo $display;
}
//to display all results of 'something' I would simply do
my_function();
However when doing the same thing using a return
Code: Select all
function my_function()
{
$sql = "SELECT something FROM table";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result))
{
$display = $row['something'];
}
return $display;
}
echo my_function();
it will only display the first result found.
What I want to do is be able to display all results found as
if I was using an echo, but by using a return.
I have read php docs and many many tuts on this.
I have yet to be able to understand how to do this
cause Arrays confuse the hell out of me

Which is why I finally came to these boards to hopefully finally figure out
this elementary task.