php-db | 2001051
Date: 05/14/01
- Next message: Robert Boehrs: "[PHP-DB] Performance of Stored Procedures ?"
- Previous message: Jordan Elver: "[PHP-DB] Printing out usernames and logins"
- In reply to: Jordan Elver: "[PHP-DB] Printing out usernames and logins"
- Next in thread: Jordan Elver: "Re: [PHP-DB] Printing out usernames and logins"
- Reply: Jordan Elver: "Re: [PHP-DB] Printing out usernames and logins"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
¥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:mru <email protected>
internet: http://www.suchtreffer.de
_______________________________________________________________
> -----Original Message-----
> From: Jordan Elver [mailto:jjelver <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 = <email protected>($sql);
>
> if( <email protected>($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 = <email protected>($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: php-db-unsubscribe <email protected>
> For additional commands, e-mail: php-db-help <email protected>
> To contact the list administrators, e-mail:
> php-list-admin <email protected>
>
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Robert Boehrs: "[PHP-DB] Performance of Stored Procedures ?"
- Previous message: Jordan Elver: "[PHP-DB] Printing out usernames and logins"
- In reply to: Jordan Elver: "[PHP-DB] Printing out usernames and logins"
- Next in thread: Jordan Elver: "Re: [PHP-DB] Printing out usernames and logins"
- Reply: Jordan Elver: "Re: [PHP-DB] Printing out usernames and logins"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

