[snip]
> > 2) How did you conclude that? Did you check that
> > list_writings(poetry)/list_writings($poetry) gives the correct
result?
> IE
> > echo list_writings(poetry)/list_writings($poetry) ?
> 
> list_writings(poetry) simply spits out the output. 'echo
> list_writings(poetry)' was not designed as the proper way to use the
> command. Here is the current code for the function (in its
half-complete
> but
> working state with mysql_connect() and mysql_select_db replaced with
> generic
> variables for public consumption), and also the std_layout function
> following:
> 
> function list_writings($table) {
> $db_link = mysql_connect($host, $user, $pw)
>         or die("DB connect failure");
> mysql_select_db ($db_name) ;
> $query = "SELECT wid, title, description FROM $table ORDER BY wid DESC
> LIMIT
> 15";
> $result = mysql_query($query, $db_link);
> while ($row = mysql_fetch_row ($result))
>         {
>         print "<a href=\"/poetry.php?wid=$row[0]\">$row[1]</a><br>";
>         };
> };

So if you want the result returned, take out that print call. Assign it
all to a variable and return it.

$retval .= "<a href=\"/poetry.php?wid=$row[0]\">$row[1]</a><br>";

and 

return($retval);

at the end of the function. Then you'll be able to do what you want. 

---John Holmes... 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to