Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script for longpolling on ajax ,for a chat

Status
Not open for further replies.

breaststroke

Programmer
Apr 10, 2011
39
0
0
ES
Hello!

I am trying to use long polling on a chat based on Ajax.
I have found some examples on the web but it isn't really clear to me.

I have to make a query to my database in order to check whether there is some (new)messages or not. I understand th elogic of the long polling, but don't know how to create the script properly.

something like this (the PHP page, which connects to the server):

Code:
...
..
//my usual query:
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chat WHERE (password1='$password1' AND password2='$password2')AND(date>($time-300))ORDER BY code DESC LIMIT 1",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{
...

How can I do a long polling in there?
My try:

Code:
...
..
$start_time = time();
//to let the server rest:
while ((time() - $start_time) < 30)
{
//mysql query to find a new message:
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chat WHERE (password1='$password1' AND password2='$password2')AND(date>($time-300))ORDER BY codigo DESC LIMIT 1",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg!=mysql_fetch_array($registros))
{
//I set a frecuence:
usleep(1000);
$registros = mysql_query("SELECT*FROM chat WHERE (password1='$password1' AND password2='$password2')AND(date>($time-300))ORDER BY codigo DESC LIMIT 1",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{
$response=$reg['myvariable'];
}
}
echo $response;
exit();
}
..
I know what I have made is a disaster :).I would appreciate any help.
Regards





enjoy practicing languages at:
 
Hi

breaststroke said:
Code:
if($reg!=mysql_fetch_array($registros))
Yepp, that condition is indeed a disaster. And sorry, but your indentation is also a disaster.

Anyway, your biggest problem is the way you use [tt]mysql_fetch_array()[/tt]. It consumes a result row on each call and you [tt]limit[/tt]ed the [tt]select[/tt] to only 1 tuple, so the second call will never have a chance to return anything.

I would write it like this :
Code:
[red]include[/red][teal]([/teal][green][i]'conexioninclude.php'[/i][/green][teal]);[/teal]
[COLOR=darkgoldenrod]mysql_set_charset[/color][teal]([/teal][green][i]'utf8'[/i][/green][teal]);[/teal]

[navy]$start_time[/navy] [teal]=[/teal] [COLOR=darkgoldenrod]time[/color][teal]();[/teal]
[b]while[/b] [teal](([/teal][COLOR=darkgoldenrod]time[/color][teal]()[/teal] [teal]-[/teal] [navy]$start_time[/navy][teal])[/teal] [teal]<[/teal] [purple]30[/purple][teal])[/teal] [teal]{[/teal]
  [navy]$registros[/navy] [teal]=[/teal] [COLOR=darkgoldenrod]mysql_query[/color][teal]([/teal][green][i]"SELECT*FROM chat WHERE (password1='$password1' AND password2='$password2')AND(date>($time-300))ORDER BY codigo DESC LIMIT 1"[/i][/green][teal],[/teal][navy]$conexion[/navy][teal])[/teal]
    [b]or[/b] [b]die[/b][teal]([/teal][green][i]"Error en el select :"[/i][/green][teal].[/teal][COLOR=darkgoldenrod]mysql_error[/color][teal]());[/teal]

  [b]if[/b] [teal]([/teal][navy]$reg[/navy][teal]=[/teal][COLOR=darkgoldenrod]mysql_fetch_array[/color][teal]([/teal][navy]$registros[/navy][teal]))[/teal] [teal]{[/teal]
    [navy]$response[/navy][teal]=[/teal][navy]$reg[/navy][teal][[/teal][green][i]'myvariable'[/i][/green][teal]];[/teal]
    [b]echo[/b] [navy]$response[/navy][teal];[/teal]
    [b]exit[/b][teal]();[/teal]
  [teal]}[/teal]

  [COLOR=darkgoldenrod]usleep[/color][teal]([/teal][purple]1000[/purple][teal]);[/teal]
[teal]}[/teal]
[small][maroon]Warning[/maroon] The above code was not tested[/small]

Feherke.
 
thank you very much Feherke.
I guess something like this would have been better:
PHP:
..
if(!$reg=mysql_fetch_array($registros))
..

anyway, I understand what you did. I have a problem, though, with this. The script we have been dealing with (your version, of course)seems to work fine, but I need another page where I get the new messages into the database.
Something goes wrong with this since it takes these messages too long to get into the database (not when I am not working on longpulling).
Maybe because while we are inside the while loop the other request get stuck waitting for it to get out?
Then I can't figure out how to solve this since I need two pages (at least one query from each), one two get the messages inside and the other to check out and print the new ones (where the while loop is).

Also, I have read that apache server (the one my files are in) is not very appropiate to handle long polling.


thank you very much for your attention and help, and sorry about my English.

Regards.

enjoy practicing languages at:
 
Hi

breaststroke said:
I guess something like this would have been better:
[gray](...)[/gray]
if(!$reg=mysql_fetch_array($registros))
Possible, if you reverse the operations too. But as the assignment is in [tt]if[/tt]'s condition, I would prefer to keep the related operations in [tt]if[/tt]'s then block.

Regarding the functionality of the whole chat, it is not clear to me. I would definitely not have condition involving date in the [tt]select[/tt] and would definitely not have [tt]limit[/tt] on it.

So better post more code, as personally I am abit lost in those details.

Feherke.
 
Thank you again Feherke.
you are right it doesn't make any sense to have a limit within the Select. I tried removing it as well.

I post the page (opened by a function triggered everytime an user click Enter in a textarea, where he/she writes):

Code:
 <?php
session_start();
?>
<?php
include('recogervariables.php');
$q = form_var('q');
$codigo=$_SESSION['codigo'];
$codigo2=$_SESSION['codigo2'];
$time=time();
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT* FROM registers WHERE codigo='$codigo'",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{
$passwordfirstchatter=$reg['password'];
$name=$reg['name'];
}

include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT* FROM registers WHERE codigo='$codigo2'",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{
$passwordsecondchatter=$reg['password'];
$name2=$reg['name'];
}

$q=mysql_real_escape_string($q);

$n=$q;
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chato WHERE ((passwordfirstchatter='$passwordfirstchatter' AND passwordsecondchatter='$passwordsecondchatter')OR (passwordfirstchatter='$passwordsecondchatter'AND passwordsecondchatter='$passwordfirstchatter'))AND(date>($time-300))",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chato WHERE (passwordfirstchatter='$passwordfirstchatter' AND passwordsecondchatter='$passwordsecondchatter')AND(date>($time-300))",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chato WHERE ((passwordfirstchatter='$passwordfirstchatter' AND passwordsecondchatter='$passwordsecondchatter')AND(date>($time-300))AND(reviewfirstchatter!='yes'))",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{
$chat=$reg['chat'];
$p=strlen($chat);
$chot = wordwrap($chat, $p, "<br />\n");
print<<<HERE
$chot
HERE;
}
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros=mysql_query("UPDATE chato
 SET reviewfirstchatter = 'yes'
 WHERE ((passwordfirstchatter='$passwordfirstchatter' AND passwordsecondchatter='$passwordsecondchatter')AND(date>($time-900))AND (reviewfirstchatter!='yes'))",$conexion)or
 die("Problems with select:".mysql_error());




include('conexioninclude.php');
mysql_set_charset('utf8');
$registros=mysql_query("INSERT INTO chato(passwordfirstchatter,passwordsecondchatter,chat, firstchatter,secondchatter,date,timefirstchatter,reviewfirstchatter) values('$passwordfirstchatter','$passwordsecondchatter','$n','$name','$name2','$time','$time','yes')",$conexion)
or die(mysql_error());

include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chato WHERE (passwordfirstchatter='$passwordfirstchatter' AND passwordsecondchatter='$passwordsecondchatter')AND(date>($time-300))AND (reviewfirstchatter='yes')",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{
$chat=$reg['chat'];
$p=strlen($chat);
$chot = wordwrap($chat, $p, "<br />\n");
print<<<HERE
$chot
HERE;
}

}

include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chato WHERE (passwordsecondchatter='$passwordfirstchatter' AND passwordfirstchatter='$passwordsecondchatter')AND(date>($time-300))",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chato WHERE ((passwordsecondchatter='$passwordfirstchatter' AND passwordfirstchatter='$passwordsecondchatter')AND(date>($time-300))AND (reviewsecondchatter!='yes'))",$conexion)
 or die("Error en el select:".mysql_error());
if($reg=mysql_fetch_array($registros))
{
$chat=$reg['chat'];
$p=strlen($chat);
$chot = wordwrap($chat, $p, "<br />\n");
print<<<HERE
$chot
HERE;
}
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros=mysql_query("UPDATE chato
 SET reviewsecondchatter = 'yes'
 WHERE ((passwordsecondchatter='$passwordfirstchatter' AND passwordfirstchatter='$passwordsecondchatter')AND(date>($time-900))AND(reviewsecondchatter!='yes'))",$conexion)or
 die("Problems with select:".mysql_error());


include('conexioninclude.php');
mysql_set_charset('utf8');
$registros=mysql_query("INSERT INTO chato(passwordfirstchatter,passwordsecondchatter,chat, firstchatter,secondchatter,date,timefirstchatter,reviewsecondchatter,datesecondchatter) values('$passwordsecondchatter','$passwordfirstchatter','$n','$name2','$name','$time','$time','yes','$time')",$conexion)
or die(mysql_error());



include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chato WHERE (passwordsecondchatter='$passwordfirstchatter' AND passwordfirstchatter='$passwordsecondchatter')AND(date>($time-300))AND (reviewsecondchatter='yes')",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{
$chat=$reg['chat'];
$p=strlen($chat);
$chot = wordwrap($chat, $p, "<br />\n");
print<<<HERE
$chot
HERE;
}

}
}
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chato WHERE ((passwordfirstchatter='$passwordfirstchatter' AND passwordsecondchatter='$passwordsecondchatter')OR (passwordfirstchatter='$passwordsecondchatter'AND passwordsecondchatter='$passwordfirstchatter'))AND(date>($time-300))",$conexion) 
 or die("Error en el select :".mysql_error());
if(!$reg=mysql_fetch_array($registros))
{
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros=mysql_query("INSERT INTO chato(passwordfirstchatter,passwordsecondchatter,chat, firstchatter,secondchatter,date,timefirstchatter,reviewfirstchatter,datefirstchatter) values('$passwordfirstchatter','$passwordsecondchatter','$n','$name','$name2','$time','$time','yes','$time')",$conexion)
or die(mysql_error());

include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chato WHERE (passwordfirstchatter='$passwordfirstchatter' AND passwordsecondchatter='$passwordsecondchatter')AND(date>($time-300))AND(reviewfirstchatter='yes')",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{

$chat=$reg['chat'];
$p=strlen($chat);
$chot = wordwrap($chat, $p, "<br />\n");
print<<<HERE
 $chot
HERE;
}
}

$codigo=$_SESSION['codigo'];
$codigo2=$_SESSION['codigo2'];
?>


I am sure it looks not well organised, but it works fine.

The first user to send a message is labeled as "firstchatter" in the database, as it stated on the last part of the page. If it is not the first message between the two (it is for two people only), we find out if they are having a conversation (if we find any messages between the two for the last 300 seconds), we find out if th emessage sent now is by firstchatter or by secondchatter. This new message is sent and got into th edatabase. It is also set a 'yes'in review(whoever)chatter, not to display this message again to the same person, when on the other page.



this would be the other page. It is set with a timeout, so we regularly chech out if there are new messages (those not send by us, because these ones are showed when we send them, as we have seen above):

Code:
<?php
session_start();
?>
<?php
include('recogervariables.php');
$q = form_var('q');
$codigo=$_SESSION['codigo'];
$codigo2=$_SESSION['codigo2'];
$time=time();
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT* FROM registers WHERE codigo='$codigo'",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{
$passwordfirstchatter=$reg['password'];
$name=$reg['name'];
}

include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT* FROM registers WHERE codigo='$codigo2'",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{
$passwordsecondchatter=$reg['password'];
$name2=$reg['name'];
}

$q=mysql_real_escape_string($q);

$n=$q;
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chato WHERE ((passwordfirstchatter='$passwordfirstchatter' AND passwordsecondchatter='$passwordsecondchatter')OR (passwordfirstchatter='$passwordsecondchatter'AND passwordsecondchatter='$passwordfirstchatter'))AND(date>($time-300))",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chato WHERE (passwordfirstchatter='$passwordfirstchatter' AND passwordsecondchatter='$passwordsecondchatter')AND(date>($time-300))",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chato WHERE ((passwordfirstchatter='$passwordfirstchatter' AND passwordsecondchatter='$passwordsecondchatter')AND(date>($time-300))AND(reviewfirstchatter!='yes'))ORDER BY codigoch ASC",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{
$chat=$reg['chat'];
$p=strlen($chat);
$chot = wordwrap($chat, $p, "<br />\n");
print<<<HERE
$chot
HERE;
}
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros=mysql_query("UPDATE chato
 SET reviewfirstchatter = 'yes'
 WHERE ((passwordfirstchatter='$passwordfirstchatter' AND passwordsecondchatter='$passwordsecondchatter')AND(date>($time-900))AND (reviewfirstchatter!='yes'))",$conexion)or
 die("Problems with select:".mysql_error());




include('conexioninclude.php');
mysql_set_charset('utf8');
$registros=mysql_query("INSERT INTO chato(passwordfirstchatter,passwordsecondchatter,chat, firstchatter,secondchatter,date,timefirstchatter,reviewfirstchatter) values('$passwordfirstchatter','$passwordsecondchatter','$n','$name','$name2','$time','$time','yes')",$conexion)
or die(mysql_error());

include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chato WHERE (passwordfirstchatter='$passwordfirstchatter' AND passwordsecondchatter='$passwordsecondchatter')AND(date>($time-300))AND (reviewfirstchatter='yes')",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{
$chat=$reg['chat'];
$p=strlen($chat);
$chot = wordwrap($chat, $p, "<br />\n");
print<<<HERE
$chot
HERE;
}

}

include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chato WHERE (passwordsecondchatter='$passwordfirstchatter' AND passwordfirstchatter='$passwordsecondchatter')AND(date>($time-300))",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chato WHERE ((passwordsecondchatter='$passwordfirstchatter' AND passwordfirstchatter='$passwordsecondchatter')AND(date>($time-300))AND (reviewsecondchatter!='yes'))ORDER BY codigoch ASC",$conexion)
 or die("Error en el select:".mysql_error());
if($reg=mysql_fetch_array($registros))
{
$chat=$reg['chat'];
$p=strlen($chat);
$chot = wordwrap($chat, $p, "<br />\n");
print<<<HERE
$chot
HERE;
}
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros=mysql_query("UPDATE chato
 SET reviewsecondchatter = 'yes'
 WHERE ((passwordsecondchatter='$passwordfirstchatter' AND passwordfirstchatter='$passwordsecondchatter')AND(date>($time-900))AND(reviewsecondchatter!='yes'))",$conexion)or
 die("Problems with select:".mysql_error());


include('conexioninclude.php');
mysql_set_charset('utf8');
$registros=mysql_query("INSERT INTO chato(passwordfirstchatter,passwordsecondchatter,chat, firstchatter,secondchatter,date,timefirstchatter,reviewsecondchatter,datesecondchatter) values('$passwordsecondchatter','$passwordfirstchatter','$n','$name2','$name','$time','$time','yes','$time')",$conexion)
or die(mysql_error());



include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chato WHERE (passwordsecondchatter='$passwordfirstchatter' AND passwordfirstchatter='$passwordsecondchatter')AND(date>($time-300))AND (reviewsecondchatter='yes')ORDER BY codigoch DESC LIMIT 1",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{
$chat=$reg['chat'];
$p=strlen($chat);
$chot = wordwrap($chat, $p, "<br />\n");
print<<<HERE
$chot
HERE;
}

}
}
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chato WHERE ((passwordfirstchatter='$passwordfirstchatter' AND passwordsecondchatter='$passwordsecondchatter')OR (passwordfirstchatter='$passwordsecondchatter'AND passwordsecondchatter='$passwordfirstchatter'))AND(date>($time-300))",$conexion) 
 or die("Error en el select :".mysql_error());
if(!$reg=mysql_fetch_array($registros))
{
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros=mysql_query("INSERT INTO chato(passwordfirstchatter,passwordsecondchatter,chat, firstchatter,secondchatter,date,timefirstchatter,reviewfirstchatter,datefirstchatter) values('$passwordfirstchatter','$passwordsecondchatter','$n','$name','$name2','$time','$time','yes','$time')",$conexion)
or die(mysql_error());

include('conexioninclude.php');
mysql_set_charset('utf8');
$registros = mysql_query("SELECT*FROM chato WHERE (passwordfirstchatter='$passwordfirstchatter' AND passwordsecondchatter='$passwordsecondchatter')AND(date>($time-300))AND(reviewfirstchatter='yes')ORDER BY codigoch DESC LIMIT 1",$conexion) 
 or die("Error en el select :".mysql_error());
if($reg=mysql_fetch_array($registros))
{

$chat=$reg['chat'];
$p=strlen($chat);
$chot = wordwrap($chat, $p, "<br />\n");
print<<<HERE
 $chot
HERE;
}
}

$codigo=$_SESSION['codigo'];
$codigo2=$_SESSION['codigo2'];
?>


I promise it works. This is where I was trying to implement the long pulling (here it is without it, just as I had it previously).

On this page it is checked if we have any messages to be shown (those that we haven't send, as we saw on the other page), they are the ones where ther is no a 'yes' in review(whoever)chatter. So we show the first of those messages (if there are more than one) and we set/update the review(whoever)chatter to 'yes'.

The problem I had and the reason why I wanted to do long polling is because the messages appeared a bit late from time to time, and I have been said that happens because the pull (not the long pulling)method consumes a lot of bandwitch.

I tried with your code and the messages from the second page (where the script is) appeared just after they appeared on the chatter who sent them, so fine.
The problem is as I told you that it takes a while for the first messages (those which come from the first page on th efirst message sender's browser) to appear, and both these and the same ones on the other chatter appear disorderly.
I think it may be becuase the first page waits for the while loop on the second page to end. I am not sure.


I appreciate your help a lot, specially because my pages may not be very clear.

Best regards.

enjoy practicing languages at:
 
Hi

Am I understanding correctly and you intend to use a single HTTP request for both sending the newly submitted message to the server and waiting for new messages from the correspondent ?

If yes, I would not do it. There are no transactions used in the database operations, so two or more long polling processes will be able to deliver the same message multiple times.


Feherke.
 
Hello feherke. Thank you again for replying.
i am not very sure about what you mean with a single HTTP request.
I have two different functions.
-The first one is triggered when an user clicks on Enter. It opens the first page i have showed here. Through a query to database it gets the message into it and shows it to the user who sendt it.
-The second one is triggered every particular time (about 1 second) through a timeOut.It opens the second page I have showed here.
This one just shows the messages from database to the other user (the one who didn't send the message).


This way it works fine but sometimes the responses are not inmediate and that's why I was trying to use Long polling.
I am trying to use Long polling only on the second page (which may be the slowest one since it is pushed by a timeOut, every second, or so).And it seems it spends a lot of bandwitch.


I implemented it while adding the while loop (just on the query to check if there are new messages to be shown (to the user who didn't show them)and also show them)on the second page.
This part is working fine. It shows the messages in a microsecond, really quick, so I am somehow relying on this technique.

The problem I am experiencng is that (I can't figure out why) the query on the first page, which enter the messages into the database, is working wrongly now. It takes it a lot of time to enter the messages (and to show them) and they aren't kept into th edatabase in order.
I don't know why the adding of the While long polling technique onto the second page is affecting this way the first page.I thought they were independent to each other when it came to do a query to the database!



Thank you very much. I hope i managed to explain my problem somehow:).

I really appreciate your help.
Regards.

enjoy practicing languages at:
 
Hi

breaststroke said:
I have two different functions.
Ok, then I misunderstood the code.

Regarding the speed of the database operations, if that frequently [tt]include[/tt]d conexioninclude.php contains database connection too, that may affect it. I would probably [tt]include[/tt] it only once.

Sorry, I see no obvious problem there for now.

Feherke.
 
Thank you feherke. I will try not including so many conexioninclude.php.
The hardest thing to understand for me is why the while loop on the second page affects the first. I hope i will find the answer, becuase I really like how the long polling works or can work. Very accurate and quick.

Thank you very much for your help.

Regards.

enjoy practicing languages at:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top