[Tool/Web/Other] SQLChat - Live MySQL server feed & chat box
#18

Quote:
Originally Posted by SchurmanCQC
Посмотреть сообщение
Using SQL and checking constantly (constantly querying!) is very inefficient and a bad idea overall.

I suggest using sockets.
http://php.net/manual/en/book.sockets.php

EDIT: Also, the preview has header warnings. It makes your code really look bad...

Another thing, I know the size of the code is small, but if you can organize things that are used in a lot of places into classes, things would be a lot more organised.

PHP код:
/*
    bool SQLClass ( string conIP, string conUser, string conPass, string conDatabase )
        This function initialises the SQL connection.
*/
class SQLClass {
    function 
SQLClass($conIP$conUser$conPass$conDatabase) {
        ...
        return 
true;
    }

I'm aware that querying a database isn't the optimal solution but this is just a prove of concept -- though this isn't that much slower than sockets especially if someone where to use MySQLi or ODBC with a persistent connection + with push (rather than poll which it uses at the moment) you would not experience any redundant queries. This is especially a good solution if your webserver has sockets disabled (which I understand many providers enforce) or if you don't want to use sockets. You're right it could have been done more efficient -- maybe I'll do that in an update (fixing the header stuff too).

As for the SQLClass -- it's not necessarily. There is no code duplication anywhere. Why would I add the complexity of OO when I just need a few lines of code.
Reply


Messages In This Thread
SQLChat - Live MySQL server feed & chat box [Updated] - by Sinner - 10.09.2013, 15:54
Re: SQLChat - Live MySQL server feed & chat box - by Black Wolf - 10.09.2013, 15:55
Re: SQLChat - Live MySQL server feed & chat box - by [HK]Ryder[AN] - 10.09.2013, 15:56
Re: SQLChat - Live MySQL server feed & chat box - by iZN - 10.09.2013, 15:57
Re: SQLChat - Live MySQL server feed & chat box - by Sinner - 10.09.2013, 16:12
Re: SQLChat - Live MySQL server feed & chat box - by XtremeR - 11.09.2013, 21:17
Re: SQLChat - Live MySQL server feed & chat box - by JeaSon - 12.09.2013, 04:13
Re: SQLChat - Live MySQL server feed & chat box - by QuaTTrO - 12.09.2013, 09:06
Re: SQLChat - Live MySQL server feed & chat box - by Sinner - 15.09.2013, 20:50
Re: SQLChat - Live MySQL server feed & chat box - by DanishHaq - 15.09.2013, 20:54
Re: SQLChat - Live MySQL server feed & chat box - by mineralo - 17.09.2013, 13:11
Re: SQLChat - Live MySQL server feed & chat box - by nGen.SoNNy - 18.09.2013, 17:46
Re: SQLChat - Live MySQL server feed & chat box - by Sinner - 18.09.2013, 18:04
Re: SQLChat - Live MySQL server feed & chat box - by nGen.SoNNy - 18.09.2013, 18:07
Respuesta: SQLChat - Live MySQL server feed & chat box - by adrianxd - 18.09.2013, 18:23
Re: SQLChat - Live MySQL server feed & chat box - by Sinner - 18.09.2013, 19:57
Re: SQLChat - Live MySQL server feed & chat box - by SchurmanCQC - 18.09.2013, 20:02
Re: SQLChat - Live MySQL server feed & chat box - by Sinner - 18.09.2013, 20:44
Re: SQLChat - Live MySQL server feed & chat box - by nGen.SoNNy - 19.09.2013, 14:28
Re: SQLChat - Live MySQL server feed & chat box - by Sinner - 19.09.2013, 16:30
Re: SQLChat - Live MySQL server feed & chat box - by nGen.SoNNy - 19.09.2013, 16:57
Re: SQLChat - Live MySQL server feed & chat box - by Sinner - 19.09.2013, 17:03
Re: SQLChat - Live MySQL server feed & chat box - by nGen.SoNNy - 19.09.2013, 17:23
Re: SQLChat - Live MySQL server feed & chat box - by Champ - 19.09.2013, 17:44
Re: SQLChat - Live MySQL server feed & chat box - by nGen.SoNNy - 19.09.2013, 17:54
Re: SQLChat - Live MySQL server feed & chat box - by -=Dar[K]Lord=- - 20.09.2013, 13:30
Re: SQLChat - Live MySQL server feed & chat box - by Sinner - 20.09.2013, 17:34
Re: SQLChat - Live MySQL server feed & chat box - by NoahF - 20.09.2013, 22:49
Re: SQLChat - Live MySQL server feed & chat box - by nGen.SoNNy - 21.09.2013, 07:21
Re: SQLChat - Live MySQL server feed & chat box - by Sinner - 23.09.2013, 09:19
Re: SQLChat - Live MySQL server feed & chat box - by amirab - 22.09.2014, 16:13
Re: SQLChat - Live MySQL server feed & chat box - by iRaiDeN - 22.09.2014, 16:57
Re: SQLChat - Live MySQL server feed & chat box - by Abagail - 23.09.2014, 01:32

Forum Jump:


Users browsing this thread: 1 Guest(s)