Re: functions?
| From: | rick | Date: | Fri, 06 Jul 2001 15:36:50 +0000 |
| Subject: | Re: functions? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-56508@lists.php.net to get a copy of this message | ||
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: <zerosumzero@yahoo.com>
To: "'Php-General (E-Mail)" <php-general@lists.php.net>
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: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>