简体   繁体   English

PHP不会更新以显示新的SQL内容

[英]Php won't update to show new sql content

When i update some text on my site and put it into the mySQL DB... the site refreshes but does not update the content to the new content in the Database, and i cannot figure out why, i have removed all cache etc... 当我更新站点上的一些文本并将其放入mySQL DB中时...该站点会刷新,但不会将内容更新为数据库中的新内容,而且我不知道为什么,我删除了所有缓存等。 。

Example, i have the page say "Lorem ipsum", and update that with my form to say "Hello there".. the page refreshes but does not change the "Lorem ipsum" before i do a force refresh.. (shift + refresh), and i have removed all cache both in my php documents but also in my .htaccess 例如,我在页面上说“ Lorem ipsum”,并用表单将其更新为“ Hello there”。.页面刷新,但在执行强制刷新之前不更改“ Lorem ipsum”。 ),并且我已经删除了所有缓存,不仅在我的php文档中,而且在我的.htaccess中

my php documents cache removal 我的php文档缓存删除

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />

Heres the retrival 继承人

$select = mysql_query("SELECT * FROM `Filling` WHERE `group` = '$page'")or die(mysql_error());
    $row = mysql_fetch_assoc($select);
    echo "$row[text]";
    ?>

Code for going back: 返回代码:

var back = document.referrer;
window.location.replace(back);

basicly, with somethings cutoff... I just cannot figure out how to get this to update properly, thanks in advance :) 基本上,有些东西被切断了...我只是想不出如何正确地更新它,在此先感谢:)

Try print_r($row); 试试print_r($row); or var_dump($row); var_dump($row); to see if there is anything in it. 看看里面有什么。

if text is a key in $row then use $row['text'] 如果文本是$ row中的键,则使用$ row ['text']

If you're using JavaScript to redirect back to the previous page using something like 如果您使用JavaScript使用类似以下的方法重定向回上一页

history.go(-1);

or 要么

history.back();

Then you are going back in the browser history, which will NOT reload your page's content. 然后,您将返回浏览器历史记录,该记录将不会重新加载页面的内容。 Instead, you should use: 相反,您应该使用:

window.location='[your page URL here]';

Or you could just post back to the same page and do your processing at the top of the script. 或者,您可以只发回同一页面,然后在脚本顶部进行处理。

I ended up making a querystring with "&time=".time(); 我最终用“&time =”。time();组成了一个查询字符串。 which forces the browser to update because it is a new URL... Thanks for all your suggestions though :) 由于它是一个新的URL,因此迫使浏览器进行更新...不过,感谢您的所有建议:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM