[PHP] The neverending Session
I'm working on a chat of sorts, and in the main frame that shows the actual messages, there is an infinite loop (while(1)) ... now, for whatever reason, when the browser is closed, the loop/thread/whatever just won't die. There are sessions involved, and the loop basically just checks a MySQL DB for new posts, and updates a timestamp in a user database. Any idea of why the loop/thread/whatever won't die? Thanks, Sean B. -- PHP General 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]
Re: [PHP] syntax for session_register();
You were close: session_register("varname"); The key thing to remember is that it's the variable name WITHOUT the $. so... $variable = "Hello"; session_register("variable"); > > Hello, > > What is the correct syntax for registering a variable that's a part of an > array. I tried these variations (i'm doing this in a loop): > > session_register('$form_val[$val]'); > > session_register($form_val[$val]); > > This registers _something_, but not what I need. Thanks for any help! > > stas -- PHP General 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] No output
I'm attempting to write a chat which streams HTML. There's a problem with the main function that's responsible for 'streaming'. It loops endlessly and if anytihng new appears in the database, it parses it into HTML and outputs it via the echo command. The chatboxDisplay method is what is responsible for parsing and echoing the message and the HTML for it. This is the problem code. The code is syntactically correct; it runs, in fact, if you remove the while stuff, it DOES work, except for the fact that it doesn't 'stream' like it should (Because it's not looping. It fires the output and the script ends). So when I put the while brackets back on to make it 'stream', there's no output. (as in, in netscape 4.7x it doesn't send much anything. the screen remains grey and just perpetually loads nothing) Any ideas as to what the heck is going on? Thanks. --- while (1) { $posts=mysql_query("SELECT * FROM chat ORDER BY date DESC;") or die ("Query failed line 111"); $data=mysql_fetch_array($posts); while ($data=mysql_fetch_array($posts)) { chatboxDisplay($data); if ($data[id] > $id) { $id = $data[id]; } } flush(); sleep(2); } -- PHP General 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]