Doh, stupid me. Thanks very much for your help. Your a life saver.

Cheers,

Jord


On Monday 14 May 2001  8:49 am, you wrote:
> ¥es, U R overwriting Ur result-set from the 1st qry.
>
> Store instead the 1st result into an array and iterate
> it then, sending your second select. U can also use 2
> connections, but ... ?
>
> Greetinx,
>   Mike
>
> Michael Rudel
> - Web-Development, Systemadministration -
> _______________________________________________________________
>
> Suchtreffer AG
> Bleicherstraße 20
> D-78467 Konstanz
> Germany
> fon: +49-(0)7531-89207-17
> fax: +49-(0)7531-89207-13
> e-mail: mailto:[EMAIL PROTECTED]
> internet: http://www.suchtreffer.de
> _______________________________________________________________
>
> > -----Original Message-----
> > From: Jordan Elver [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, May 14, 2001 7:35 PM
> > To: PHP DB List; PHP General List
> > Subject: [PHP-DB] Printing out usernames and logins
> >
> >
> > Hi,
> > I'm trying to print out a list of usernames and the times
> > they logged in.
> >
> > I want to print it out like:
> >
> > joe
> > fred
> > frank
> >
> > Then when you click on one of the names it show just there
> > login times, like
> > this, so if I click on fred it prints out:
> >
> > joe
> > fred
> > - <login time>
> > - <login time>
> > - <login time>
> > frank
> >
> > But it doesn't continue printing out the rest of the
> > usernames after it's
> > finished printing freds logins.
> >
> > Any ideas would be appreciated.
> >
> > The code seems to have something to do with the second query,
> > I think
> >
> >
> > The code I'm using is below.
> >
> > Thanks,
> >
> > Jord
> >
> > db_connect();
> > $sql = "SELECT id, username FROM users";
> > $result = @mysql_query($sql);
> >
> > if(@mysql_num_rows($result) > 0) {
> >
> >     echo'This is a list of Members who have Logged In to
> > their account with
> > times and dates:<BR><BR>';
> >
> >     while(list($id, $username) = mysql_fetch_array($result)) {
> >
> >         echo"<A
> > HREF=\"$PHP_SELF?user=$username&id=$id\">$username</A><BR>\n";
> >
> >         if($username == $user) {
> >
> >             $sql = "SELECT UNIX_TIMESTAMP(time) AS time FROM
> > user_logins
> > WHERE user_id = $id ORDER BY time DESC";
> >             $result = @mysql_query($sql);
> >
> >             while(list($time) = mysql_fetch_array($result)) {
> >                 echo date('h:i a l d F', $time)."<BR>\n";
> >             }
> >         }
> >     }
> >
> > } else {
> >     echo error('No one has Logged In yet!');
> > }
> >
> > --
> > PHP Database 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 Database 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]

Reply via email to