Re: Function fails on second consecutive call
| From: | (Philip Hallstrom) | Date: | Mon, 05 Jun 2000 21:20:49 +0000 |
| Subject: | Re: Function fails on second consecutive call | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-1096@lists.php.net to get a copy of this message | ||
Add the following line right before your "while" statement:
reset($tables["user"]);
In article <JPEHJAKOPEIKNFDDEGABMEPJCAAA.PaulS@ha4it.net>,
Paul Strange <PaulS@ha4it.net> 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