Forum Moderators: coopster
I'm a newby in LAMP.
I got 2 mysql tables in database "X"
1rst table Users has 2 fields i'm interested with:
"ID": is a varchar(8) containing ID of registered users
"Image": is a blob containing uploaded thumbnails of registered users.
2nd table Online has two fields i'm interested with:
"Connected" and "Room".
Both fields are int(11)
Both 2nd table fields are autoupdated by a a chat "engine" depending on wich users are logged-in inside the chat.
The 2nd table field "Connected" can contain only values available also in the 1rst table->field ID.
In fact users logged in the chat can be only registered ID users.
My goal is to create a php script able to check who's "Connected" in the chat then display the right "Image" in a autoupdating html page showing in a 3 columns table the right values: "Image"; "Connected" or "ID" and "Room" of the chat logged-in users.
Who can give me an help?
GD libraries allowed.
Thanks.
why doesn't work? While cycle break because of second query?
<?php
$query = "SELECT userName, channel FROM $tabella_online";
$result = mysql_query($query);
if(!$result) messaggio_errore(errore_sql());
while($query_data = mysql_fetch_array($result)) {
$nome = $query_data["userName"];
$stanza = $query_data["channel"];
$query = "SELECT immagine FROM $tabella_utenti WHERE id='$nome'";
$result = mysql_query($query);
if(!$result) messaggio_errore(errore_sql());
$query_data = mysql_fetch_array($result);
$path = "./".$query_data["immagine"];
echo "<TR>";
echo "<TD WIDTH=\"33%\" ALIGN=\"CENTER\"><img src=\"$path\" width=100%></TD>\n";
echo "<TD WIDTH=\"33%\" ALIGN=\"CENTER\">$nome</TD>\n";
echo "<TD WIDTH=\"33%\" ALIGN=\"CENTER\">$stanza</TD>\n";
echo "</TR>\n";
}
?>
It seems like a JOIN might work here, too. Here is an example of a "who's online" solution that may be helpful to study:
[webmasterworld.com...]