English 中文(简体)
从数据库中获取数据,而不复一页
原标题:Get data from database without refresh whole page

我的项目是一所学校行政,有一个称为:创建Class.php的网页,用户在那里插入年级、简介等。 当他发布“报到”的网页时,他会打上“报到” 班级。 php正在装载。 在网页上,我有将数据输入数据库的所有代码,也有“如果”结构,说明:如果数据库中是另一个具有相同规格的类别,则“已经存在”。 也在第二页(Class.php) i 有一个小表显示每个学生的位置。 首先,所有的囚室都是绿色的(这意味着该地是免费的),如果一只点点击其中的囚室似乎有一个人满为患的窗口,请允许我从这个地方增加有关学生的信息。 如果一个地方忙).,该囚室将红色(见以下网址:)。 最大的问题是,只有在复读网页(请数据库提供数据的地点)之后,该囚室才会红色。 如果我的新闻复读似乎“已经存在阶级”。 在评论中添加了所有经核实和补充课堂的内容。 我认为,我的问题可以解决。 I m等着回答。 关于Stefan

最佳回答

在插入数据之后(一般说来)您必须将用户转至另一页。

改变形式 页: 1

<?php

if ($_SERVER[ REQUEST_METHOD ] ==  POST ) {
    // insert the data here
    header( Location: /createdClass.php );
    exit();
}

?>

<form action="<?php echo $_SERVER[ PHP_SELF ]; ?>" method="post">
...
</form>

(最新)流动情况如下:

  1. The user is shown a form in createClass.php
  2. When user submits the form, the submission is handled in the same createClass.php, which inserts database row and then shown no page but tells the browser to go to createdClass.php .
  3. Now browser loads createClass.php, which just shows the student table (but makes no database inserts!). Now you can refresh createClass.php as many times as you want without side effects.

请注意,上述问题可能无法解决所有问题。 如果没有更多的信息(或法典),我就无法提供帮助。

问题回答

为了从人群中恢复原来的窗户,使用这一套 j:

window.opener.location.refresh();




相关问题
what is wrong with this mysql code

$db_user="root"; $db_host="localhost"; $db_password="root"; $db_name = "fayer"; $conn = mysqli_connect($db_host,$db_user,$db_password,$db_name) or die ("couldn t connect to server"); // perform query ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

Easiest way to deal with sample data in Java web apps?

I m writing a Java web app in my free time to learn more about development. I m using the Stripes framework and eventually intend to use hibernate and MySQL For the moment, whilst creating the pages ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How can I know if such value exists in database? (ADO.NET)

For example, I have a table, and there is a column named Tags . I want to know if value programming exists in this column. How can I do this in ADO.NET? I did this: OleDbCommand cmd = new ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签