hay other than having the script log to the sql why not just have it log to a plain text file in the /ChatRoom directory and also log IP's like this other script i have.
Example:
[Tue Jun 23 06:37:35 2009] "bob" entered the room, IP- 63.26.97.131
[Tue Jun 23 06:37:40 2009] "bob" left the chat
[Tue Jun 23 08:38:25 2009] "sdg" entered the room, IP- 63.26.108.98
[Tue Jun 23 08:38:46 2009] "sdg" left the chat
[Thu Jun 25 19:31:31 2009] "Casper" entered the room, IP- 63.26.115.224
[Thu Jun 25 19:31:43 2009] "Casper" left the chat
[Thu Jun 25 20:54:18 2009] "Casper" entered the room, IP- 63.26.115.224
[Thu Jun 25 20:54:27 2009] "Casper" : ding
[Thu Jun 25 20:54:29 2009] "Casper" : hay
[Thu Jun 25 20:57:13 2009] "Casper" left the chat
[Thu Jun 25 21:36:52 2009] "rizsanjose" entered the room, IP- 120.28.167.136
[Thu Jun 25 21:37:19 2009] "rizsanjose" : hi
[Thu Jun 25 21:37:34 2009] "rizsanjose" left the chat
[Thu Jun 25 23:33:17 2009] "Casper" entered the room, IP- 63.26.115.224
[Thu Jun 25 23:33:21 2009] "Casper" :
[Thu Jun 25 23:33:24 2009] "Casper" :
[Thu Jun 25 23:34:08 2009] "Casper" left the chat
[Fri Jun 26 06:31:21 2009] "kiki" entered the room, IP- 72.68.34.176
[Fri Jun 26 06:32:47 2009] "kiki" left the chat
[Fri Jun 26 09:12:29 2009] "jmtaller" entered the room, IP- 99.173.22.57
[Fri Jun 26 09:12:42 2009] "jmtaller" left the chat
[Fri Jun 26 16:39:03 2009] "Turkýshman" entered the room, IP- 85.106.122.51
[Fri Jun 26 16:39:09 2009] "Turkýshman" left the chat
[Fri Jun 26 19:08:12 2009] "brooklyn" entered the room, IP- 173.24.13.207
[Fri Jun 26 19:09:00 2009] "brooklyn" left the chat
[Fri Jun 26 19:09:35 2009] "brooklyn" entered the room, IP- 173.24.13.207
[Fri Jun 26 19:09:43 2009] "brooklyn" : what it do
[Fri Jun 26 19:09:53 2009] "brooklyn" left the chat
[Fri Jun 26 19:38:25 2009] "jamie" entered the room, IP- 12.27.244.5
[Fri Jun 26 19:38:38 2009] "jamie" left the chat
[Sat Jun 27 16:20:13 2009] "Heshan" entered the room, IP- 77.31.221.241
[Sat Jun 27 16:21:48 2009] "Heshan" : hi
[Sat Jun 27 16:28:11 2009] "Heshan" left the chat
[Sat Jun 27 16:57:14 2009] "Turkýshman" entered the room, IP- 85.106.100.130
[Sat Jun 27 16:57:24 2009] "Turkýshman" left the chat
[Sat Jun 27 19:18:39 2009] "just_some_girl" entered the room, IP- 68.61.67.242
[Sat Jun 27 19:30:31 2009] "lilmama#1" entered the room, IP- 67.141.105.147
[Sat Jun 27 19:30:46 2009] "lilmama#1" left the chat
This would be super cool because then you can ban Ips through your Cpanel.