Dobrý deň, učim sa robiť chat do školy trochu zložitej ši a potrebujem poradiť lebo neviem s tým pohnuť...
Vybere mi iba z DB jedneho odosielatela čo si aktualne snim piše ale ked som skušal aby viaceri pisali si spolu tak to nešlo..... Prosim o pomoc... Ďakujem
require_once ('db.inc.php');
do {
if (!OpenDB()) break;
//Vyber chatu
$sql = "select * from chat where klient = '$klient' AND redaktor = '$redaktor' AND stav = '1' ORDER BY `id` ASC ";
$result = mysql_query($sql);
while ($row = mysql_fetch_object($result)):
$id = $row->id;
$meno_zakaznika = $row->uzi_meno;
$email_zakaznika = $row->uzi_email;
if ($meno_zakaznika == "")
{
$meno_zakaznika = "Zakaznik";
}
//Vyber klient
$sql = "select * from uzivatelia where id = '$redaktor'";
$result = mysql_query($sql);
while ($row = mysql_fetch_object($result)):
$meno_redaktora = $row->nick;
endwhile;
//Vyber spravy
$sql = "select * from sprava where chat = '$id'";
$result = mysql_query($sql);
while ($row = mysql_fetch_object($result)):
$text = $row->text;
$time = $row->time;
$autor = $row->autor;
if ($autor == "1")
{
$autor = $meno_redaktora;
}
else
{
$autor = $meno_zakaznika;
}
echo "$autor/$time<br> $text<br>";
if ($id != "" AND $text == "")
{
echo "Novy zakaznik dosiel";
}
endwhile;
endwhile;
mysql_close();
} while (false);
ďakujem za pomoc ak viete