Mailinglisten-Archive |
This is a multi-part message in MIME format. ------=_NextPart_000_0015_01C00247.D9420510 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit hi liste dieses script was ich benutze um ständig daten aus der db in eine seite zu laden zerrt an meinen systemresourcen die sql prozesse sind imens. komischerweise auch wenn ich das script abgeschaltet hab und es vorher laufen hatte ich muss immer den apache ausschalten damit die sql prozesse gestoppt werden. kann mir jemand helfen das zu optimieren ? mfg, cu_(at)_listor ------=_NextPart_000_0015_01C00247.D9420510 Content-Type: application/octet-stream; name="stream.php3" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="stream.php3" <? # die funktion um den chat laufen zu lassen # <? function get_last_num() { mysql_connect("localhost","",""); mysql_select_db("flaptown"); $coun =3D mysql_query("select count(*) from chatmsg as num"); $result =3D mysql_fetch_row($coun); $a =3D $result[0]-1; $b =3D $result[0]; $lastnum =3D mysql_query("SELECT num FROM chatmsg limit $a,$b"); $lastnum =3D mysql_fetch_row($lastnum); return $lastnum[0]; mysql_close(); } set_time_limit(0); $tim =3D getdate(); $ftim =3D $tim[hours] . ":" . $tim[minutes] . ":" . $tim[seconds]; $c =3D get_last_num(); ignore_user_abort(0); echo "<font style=3D\"font-family:verdana;font-size:8pt;\" >Willkommen = im Flap-Town Chat<br><br>"; flush(); while(!connection_aborted()) { clearstatcache(); if($c<get_last_num()) { mysql_connect("localhost","",""); mysql_select_db("flaptown"); $result_msg =3D mysql_query("SELECT * FROM chatmsg WHERE ((num > '$c') = && (time > '$ftim'))");=20 $msg =3D mysql_fetch_row($result_msg); if($msg[3] !=3D "") { echo $msg[3] . "<br>\n"; flush(); }=20 $c =3D get_last_num(); mysql_close(); } } ?> ------=_NextPart_000_0015_01C00247.D9420510--
php::bar PHP Wiki - Listenarchive