Home page redirection in php long polling
Reply: 0

page redirection in php long polling

user1302
1#
user1302 Published in April 24, 2018, 6:42 am

I am using php-long-polling to display data to user on instant basis in one of my projects. I got the script from here https://github.com/panique/php-long-polling When counter sets to 1 it has to redirect to some other page. This redirection is not happening in server.php script.

ob_start();
set_time_limit(0);

include('includes/sessions.php');
while (true) {
    $last_ajax_call = isset($_GET['timestamp']) ? (int)$_GET['timestamp'] : null;
$id = $_GET['id'];

       $sql = "SELECT max(gid) FROM grp WHERE gid=".$id."";
        $result = mysqli_query($con, $sql);
    if ($last_ajax_call == null || $last_change_in_data_file > $last_ajax_call) {
      $sql = "SELECT is_set, start FROM grp WHERE gid =".$id."";
        $result = mysqli_query($con, $sql);
        if (mysqli_num_rows($result) > 0) {

            while($row = mysqli_fetch_assoc($result)) {


              if(($row['is_set'] == 1) && ($row['start'] == 1))
               {
//Here redirection should happen
$data .= "<script> window.location.href = './result.php?id=".$id."</script>";
}
}
}

I tried

header("location:result.php?id=$id");
exit();

But nothing did work. why these redirection not working.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.308312 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO