Jump to content
nmoa

ciclo email

Recommended Posts

nmoa

bom dia

gostaria me dessem um dica de como fazer isto:

tenho uma admin onde os users tem acesso a varias coisas inclusive mensagens enviadas entre users

o que queria fazer era: criar um ciclo que em cada vez que chegasse uma nova msg e o user tivesse logado aparecesse uma notificação a informar que tinha uma nova msg por ler.

eu tenho assim

 

$(document).ready(function(){
    var temp= setInterval(update,6000);
    var Stacks = {
    stack_bar_top: {
            "dir1": "down",
            "dir2": "right",
            "push": "top",
            "spacing1": 0,
            "spacing2": 0
          },
    }

function update (){
    clearInterval(temp);
     var noteStack = "stack_bar_top";
     var noteStyle= "warning";
     var width = "290px";
    $.ajax({
        url:"entrada.php?page=60",
        type:"post"        
    }).done(function (resposta){
        var r="tem novas mensagens por ler";
        if (resposta !=0){
          new PNotify({
            title: 'Mensagens',
            text: r,
            type: noteStyle,
            stack: Stacks[noteStack],
            width: "100%",
            delay: 3000
          });
          //var temp =setInterval(update,6000);
    
            }
   
    })
}

})

a page=60 é um php

<?php

require_once '../connect.php';connect();

$comercial= mysql_query("SELECT * FROM comercial where email='".$_SESSION["user"]."' ");
$comer= mysql_fetch_array($comercial);

$msg= mysql_query ("SELECT * FROM msg_entrada where comercial_recetor=".$comer["id_comercial"]." and respondia =0");
$conta= mysql_num_rows($msg);
echo $conta;

?>

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.