instead of returning that line, put it into some variable... like:
while ($row = mysql_fetch_row ($result)) {
$map_list .= "<a href='viewonly.php3?mapid=$row[1]'>$row[0]</a><br>"; }
}
return $map_list;
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: "'Php-General (E-Mail)" <[EMAIL PROTECTED]>
Sent: Friday, July 06, 1979 8:27 AM
Subject: [PHP] functions?
> Okay there is a file called global.inc
>
> <?php
>
> // display a list from the DB
>
> function list_of_maps () {
>
> db_connect ();
> $sql = "SELECT mapname,rowid FROM maps";
> $result = mysql_query($sql);
>
> while ($row = mysql_fetch_row ($result)) {
> return "<a href='viewonly.php3?mapid=$row[1]'>$row[0]</a><br>"; }
>
> }
>
>
>
> ?>
>
> But when I call it like this:
>
> <?php
>
> include('global.inc');
> echo list_of_maps ();
>
> ?>
>
> It only shows the first result from the db... How do I get it to list them
> all?
>
>
> Susan
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]