php - When I update MySQL row when i request same row by json i recieve old value -


when update mysql row when request same row json receive old value although value on server correct in phpmyadmin . , after calling 2 or 3 time receive correct value .

 $id=$_post['id'];   $type=$_post['type'];  $study=$_post['study'];   $text=$_post['text'];  $date=$_post['date'];  $picture=$_post['picture'];  $notes=$_post['notes'];   $text= addslashes($text);  $text=htmlspecialchars($text);   $notes= addslashes($notes);  $notes= htmlspecialchars($notes);   $continued = mysql_connect(localhost,somebodyuser,password);   if($continued){ echo(""); }else{ echo("connection fail");  } mysql_select_db("u599749231_rose")or die("cannot select db");  mysql_query("set character_set_server='utf8'"); mysql_query("set names 'utf8'");    $update=mysql_query("update achive set type= '$type', study = '$study', text= '$text',          date = '$date' , picture ='$picture' , notes = '$notes'  id='$id'");     if($update)       {      echo'1';     }      else    {      echo'0';  }      mysql_close($continued);  ?> 

it sounds php script returning cached data. use following header calls in php script before returning data client:

header("cache-control: no-cache, must-revalidate"); // http/1.1 header("expires: mon, 26 jul 1997 05:00:00 gmt");   // date in past 

hope helps...


Comments

Popular posts from this blog

php - Magento - Deleted Base url key -

javascript - Tooltipster plugin not firing jquery function when button or any click even occur -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -