0
I upload a PHP file that brings me an image in jpg. Code:
<?php
$url = "http://site.com.br/sistema/";
?>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
$('#load_tweets').load('arquivo.php').fadeIn("slow");
}, 1000); // refresh every 10000 milliseconds
</script>
<div id="load_tweets">
</div>
php file is like this:
<?php
$conecta = mysql_connect('localhost','teste','teste')or die(mysql_error());
$banco = mysql_select_db('nomeBanco');
$selecionaTabela = mysql_query("SELECT * FROM noticias WHERE id = '187'")or die(mysql_error());
$dados = mysql_fetch_array($selecionaTabela);
?>
<img src="modulos/upload/<?php echo $dados['fotoEvento'];?>" alt=""/>
But in Chrome the image keeps flashing, already in Mozilla no!
It’s the same as Facebook, when you publish something, the photo of the person who posted the news appears, and the content below...but the photo of the person is flashing in Chrome
– user3081
I put an ORDER BY id DESC...when new news comes, will appear first, same as Facebook Internet. It’s a Timeline system that I created, but the problem is that the image of the profile of the person who posted the news is flashing in Chrome. Flasher why set 1000 milliseconds
– user3081
These id is coming from a single table of mysql called (noticas) everything that is registered in this table, will appear in Timeline
– user3081
Anyway, do not replace all the contents of the
#load_tweets
once a second. Search only for new content, and enter at the end of the div if there is any. This should solve the problem. I also recommend using a range greater than 1 second for verification.– bfavaretto
Excuse the ignorance, but how can I know if there is a new content register in this table?
– user3081
It depends on the structure of your table. If you have a date/time field, you can rely on it. Or a unique id for each table row. Note: I will delete some of my old comments, to give a clean question.
– bfavaretto