重新加载页面时未定义的索引

时间:2016-01-11 22:37:02

标签: php html

在我的PHP代码中,一切正常,数据被检索,消息显示...我的意思是一切正常,但是,在页面上显示所需的数据后...当我点击刷新按钮时它不再显示数据,而是显示未定义的索引错误,帮助人;这是我的代码:

<?php 

session_start();
$pass = $_POST['pass'];
$id   = $_POST['id'];

if ($pass&&$id) {
$connect = mysql_connect("localhost","root","") or die("Could not connect to    the database");
 mysql_select_db("aiita") or die("Database not exist");
 mysql_query("SET NAMES 'utf8'");
 mysql_query('SET CHARACTER SET utf8');

   $query = mysql_query("SELECT * FROM attestation WHERE pass='$pass' ");
    $numrows = mysql_num_rows($query);

   if ($numrows!==0) {
    while($row = mysql_fetch_assoc($query))
    {
        $dbpass = $row['pass'];
        $dbid   = $row['id'];

    }
    if ( $pass===$dbpass && $id===$dbid ) {

    $show=mysql_query("SELECT `name` FROM `attestation` WHERE id='$id'");
    while ( $row=mysql_fetch_array($show)) {
        echo '<center><span style="font-size:40px;font-family:    serif;">'.$row['name'].'</span></center>';
        echo '<center><span style="font-size:20px;font-family:   serif;">'.'المعهد يتمنى لكم مسيرة موفقة'.'</span></center>';
    }


    $res=mysql_query("SELECT `images` FROM `attestation` WHERE id='$id'");
    echo "<table>";
    while ($row=mysql_fetch_array($res)) {
        echo "<tr>";
        echo "<td>";?><img src="<?php echo $row ["images"]; ?>" <?php "   </td>";


        echo "</tr>";


      }


      $_SESSION['id']=$id;


    }

       else
        echo "....."


    ?>

0 个答案:

没有答案