SoireeExtreme Posted February 29, 2008 Share Posted February 29, 2008 I was wondering if anyone could help me... I've been working on this for days and can't seem to figure it out. I've searched up and down everywhere. And I've come up with just about nothing. Now I have two problems... I only need the answer to 1 of them. First would be forcing the scroll bar to the bottom of a chat box iframe where the messages are displayed. I've tried several different ways and the forcing doesn't work. The reason why I think it doesn't is because of the flush and sleep... But if take those out The page doesn't load correctly. Its like it freezes... So if anyone could help me get this to scroll to the bottom or load correctly that would be great.... Now if I can't get that to work above then my other solution would be to get the messages to appear in reverse order and have message new messages appear at the top of the chat box iframe instead of at the bottom. Hence taking care of the scrolling problem.... So if any of this can be done I would appreciate it greatly. And a GREAT BIG THANK YOU in advance.... <?php include "lang.inc.php"; include '../connect.php'; ?> <html> <head> </head> <Body onload="javascript:window.self.location.href='#bottom'"> <?php //iframe for chat module set_time_limit(0); include "../connect.php"; include "var.php"; $getrows="SELECT * from ch_messages"; $getrows2=mysql_query($getrows); $getrows3=mysql_num_rows($getrows2); $s=$getrows3-30; if($s<0) { $s=0; } $id=0; while(!connection_aborted()) { $id++; print "<script type='text/javascript'>"; print "window.location.hash = 'm$id';"; print "</script>"; $getmessage="Select * from ch_messages order by time ASC limit $s,$getrows3"; $getmessage2=mysql_query($getmessage) or die("Could not get messages"); while($getmessage3=mysql_fetch_array($getmessage2)) { $filter="$getmessage3[message]"; $smilies=array( ':^' => "<img src='images/icon_evil.gif'>", ':B' => "<img src='images/icon_idea.gif'>", 'lol' => "<img src='images/icon_lol.gif'>", ':M' => "<img src='images/icon_mad.gif'>", ':r' => "<img src='images/icon_redface.gif'>", ':[' => "<img src='images/icon_sad.gif'>", ':S' => "<img src='images/icon_surprised.gif'>", ':w' => "<img src='images/icon_twisted.gif'>", '[]' => "<img src='images/icon_right.gif'>", '' => "<img src='images/icon_razz.gif'>", '' => "<img src='images/icon_biggrin.gif'>", '' => "<img src='images/icon_cool.gif'>", ':?' => "<img src='images/icon_confused.gif'>", ':c' => "<img src='images/icon_cry.gif'>", '' => "<img src='images/icon_eek.gif'>", '!' => "<img src='images/icon_exclaim.gif'>", ':}' => "<img src='images/icon_mrgreen.gif'>", ':l' => "<img src='images/icon_neutral.gif'>", '' => "<img src='images/icon_wink.gif'>", '' => "<img src='images/icon_smile.gif'>", ':~' => "<img src='images/icon_rolleyes.gif'>" ); $filter=str_replace(array_keys($smilies), array_values($smilies), $getmessage3[message]); if($getmessage3[registered]==1) { print "<font color='$registeredcolor'>$getmessage3[poster]</font>: $filter<br />"; $s++; print "<A name='m$id'>"; } else if($getmessage3[registered]==0) { print "<font color='$unregisteredcolor'>Unregistered</font>: $getmessage3[message]<br />"; $s++; print "<A name='m$id'>"; } } if($s>=$getrows3) { print "<a name='bottom'></a>"; flush(); sleep(1); } } ?> </body></html> Quote Link to comment Share on other sites More sharing options...
wobbit Posted February 29, 2008 Share Posted February 29, 2008 Try this (I presume you have a id field or a date field you can use): $getrows="SELECT * from ch_messages ORDER BY id DESC"; Can't remember if its that way up or $getrows="SELECT * from ch_messages ORDER BY id ASC"; Quote Link to comment Share on other sites More sharing options...
SoireeExtreme Posted February 29, 2008 Author Share Posted February 29, 2008 Thanks for the reply but that doesn't work. I've tried it already... It does change the order... But it doesn't enter a new message correctly when posted. And new messages still load at the bottom of the iframe instead of at the top of the iframe... I need the new posted messages at the top of the iframe working its way down to the bottom showing the older messages that have been entered. Quote Link to comment Share on other sites More sharing options...
wobbit Posted February 29, 2008 Share Posted February 29, 2008 Can you upload the schema (layout) for that table? Quote Link to comment Share on other sites More sharing options...
SoireeExtreme Posted February 29, 2008 Author Share Posted February 29, 2008 are you talking about the style.css file? Quote Link to comment Share on other sites More sharing options...
wobbit Posted February 29, 2008 Share Posted February 29, 2008 Sorry, no I mean the database table layout. As in, what fields there are in the table and what type of field they are. Wob Quote Link to comment Share on other sites More sharing options...
SoireeExtreme Posted February 29, 2008 Author Share Posted February 29, 2008 Does this help? -- -- Table structure for table `ch_messages` -- CREATE TABLE IF NOT EXISTS `ch_messages` ( `ID` bigint(21) NOT NULL auto_increment, `poster` varchar(255) collate latin1_general_ci NOT NULL default '', `message` mediumtext collate latin1_general_ci NOT NULL, `registered` int(11) NOT NULL default '0', `time` bigint(21) default NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=128 ; -- -------------------------------------------------------- -- -- Table structure for table `ch_online` -- CREATE TABLE IF NOT EXISTS `ch_online` ( `ID` bigint(21) NOT NULL auto_increment, `sessionname` varchar(255) collate latin1_general_ci NOT NULL default '', `time` int(11) NOT NULL default '0', PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=43 ; Quote Link to comment Share on other sites More sharing options...
SoireeExtreme Posted February 29, 2008 Author Share Posted February 29, 2008 I still haven't solved my problem. Any other help would be great thanks... Quote Link to comment Share on other sites More sharing options...
SoireeExtreme Posted February 29, 2008 Author Share Posted February 29, 2008 bump Quote Link to comment Share on other sites More sharing options...
SoireeExtreme Posted February 29, 2008 Author Share Posted February 29, 2008 bump again. Am I asking for help in the wrong place. Am I being misunderstood? Can't anyone help me out and point me in the right direction? Seems that the help around here is starting to go down hill... Quote Link to comment Share on other sites More sharing options...
SoireeExtreme Posted March 1, 2008 Author Share Posted March 1, 2008 Wow such a helpful bunch around here thanks for nothing. Quote Link to comment Share on other sites More sharing options...
trq Posted March 1, 2008 Share Posted March 1, 2008 bump again. Am I asking for help in the wrong place. Am I being misunderstood? Can't anyone help me out and point me in the right direction? Seems that the help around here is starting to go down hill... Yeah, and comments like that will get you loads of help. Its not like where getting paid to be here, we volunteer our time. If you don't like it ask your questions somewhere else, but don't complain, sheesh. Quote Link to comment Share on other sites More sharing options...
JasonO Posted March 1, 2008 Share Posted March 1, 2008 Can't give to much information and only done a quick read. You want messages sent to appear at the top of a list of other messages, and go through in time/date posted order? I would simply add a timestamp to the messages, and then ordering by the timestamp. That should order them by date or time posted. Sorry I haven't got into to much info (about to go to get some sleep), but you should be able to find some stuff about ordering by timestamps etc. Quote Link to comment Share on other sites More sharing options...
SoireeExtreme Posted March 1, 2008 Author Share Posted March 1, 2008 I know people volunteer their time here to help out. But aren't there suppose to be people actually working here to help a person out too? yeah I think so. Thats what happens when you offer such a service as this. People actually help you and dont' leave you sitting around... I didn't come here to ask your opinion on such things anyways. I asked for help on something I was having a problem with but like I said the service and help here is doing downhill. I sat here waiting and waiting... But this isn't the first time this has happened that I sat here and had to repost my questions. But if this is the kind of help and comments I'm going to get from people like you around here then I surely don't need to be here. Not in a place amoung losers who think the are on top of the world when they aren't Mr. Super Mod... Like I said I didn't ask for you opinion. I asked for help. So be helpful or shut your trap! But doesn't matter I'm not coming around here again. And its people like you why this world is and turning more and more into a crap hole of a place... I was making a simple statement that the help is going downhill. So there was no need for you lame remarks as you so stated! But this is my last post here! Hope you have a horrible life and wish you all the bad luck in the world..................................... ;D ;D ;D ;D ;D ;D :D :D :D :D . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.