RE: [PHP-GENERAL] Function fails on second consecutive call
| From: | Paul Strange | Date: | Mon, 05 Jun 2000 21:27:18 +0000 |
| Subject: | RE: [PHP-GENERAL] Function fails on second consecutive call | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1095@lists.php.net to get a copy of this message | ||
I was able to fix it with reset ($tables["user"]) call before the while
loop. Thanks for the help.
-----Original Message-----
From: Rasmus Lerdorf [mailto:rasmus@php.net]
Sent: Monday, June 05, 2000 3:23 PM
To: Paul Strange
Cc: php-general@lists.php.net
Subject: Re: [PHP-GENERAL] Function fails on second consecutive call
Add a reset($tables) call before your while loop
On Mon, 5 Jun 2000, Paul Strange wrote:
> I have a function that pulls data from the database and then displays it
on
> the screen (see below for code). If I call this function once, everything
> works fine. However, if I try to call it twice, the first series of data
> shows up but the second does not. Any ideas would be greatly appreciated.
>
> --- <snip> ------
> function showinfo($userid)
> {
> // Global Variables
> global $tables;
>
> $linkid = connection();
>
> echo ("User id = ". $userid);
>
> echo ("<table border ='0'>");
> echo ("<tr>");
>
> while (list($key, $val) = each ($tables["user"]))
> {
> if ($key == 3)
> {
> echo("</tr><tr>");
> }
> $result = my_query("select * from $val where userid='$userid'",
$linkid);
> ftable($val, $result);
> }
>
> echo ("</tr>");
> echo ("</table>");
> }
>
> --- <snip> ------
>
> Paul Strange
>
>
>
--
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