Home >Backend Development >PHP Tutorial >PHP按钮返回404异常

PHP按钮返回404异常

WBOY
WBOYOriginal
2016-06-13 12:15:141430browse

PHP按钮返回404错误
书上的内容,然后已经建立了数据库和login.php文件。

<?php<br />    require_once 'login.php';<br />    $db_server = mysql_connect($db_hostname,$db_username,$db_password);<br /><br />    if(!$db_server)die("Unable to connect to MySQL:".mysql_error());<br /><br />    mysql_select_db($db_database)<br />    or die("Unable to select to MySQL:".mysql_error());<br />    <br />    if(isset($_post['delete']) && isset($_POST['isbn']))<br />    {<br />        $isbn = get_post('isbn');<br />        $query = "DELETE FROM classics WHERE isbn='$isbn'";<br />        <br />        if(!mysql_query($query, $db_server))<br />        echo "DELETE failed: $query<br />".mysql_error()."<br /><br />";<br />    }<br />    <br />    if(isset($_post['author']) &&<br />       isset($_post['title']) &&<br />       isset($_post['category']) &&<br />       isset($_post['year']) &&<br />       isset($_post['isbn']))<br />        {<br />            $author = get_post('author');<br />            $title = get_post('title');<br />            $category = get_post('category');<br />            $year = get_post('year');<br />            $isbn = get_post('isbn');<br />            <br />              $query = "INSERT INTO classics VALUES".<br />              "('$author','$title','$category','$year','$isbn')";  <br />              <br />            if(!mysql_query($query, $db_server))<br />            {<br />                echo "INSERT failed: $query<br />".mysql_error()."<br /><br />";<br />            }<br />        }<br />    <br />    echo <<<_END<br /><br />        <form action="sqltext.php" method="post"><br />        <br />            <pre class="brush:php;toolbar:false"><br />                <br />                  Author <input type="text" name="author" /><br />                   Title <input type="text" name="title" /><br />                Category <input type="text" name="category" /><br />                    year <input type="text" name="year" /><br />                    ISBN <input type="text" name="isbn" /><br />                    <br />                    <input type="submit" value="ADD RECORD" /><br />            <br />            

        
        
        
_END;
    
    $query = "SELECT * FROM classics";
    $result = mysql_query($query);
    
    if(!$result) die("Datebase access failed: ".mysql_error);
    
    $rows = mysql_num_rows($result);
    
    for($j = 0; $j    {
        $row = mysql_fetch_row($result);
            echo         

<br>               Author $row[0]<br>                Title $row[1]<br>             category $row[2]<br>                 year $row[3]<br>                 ISBN $row[4]<br>        

        

        
        
        
        

            
_END;
    }
    
    mysql_close($db_server);
    
    function get_post($var)
    {
            return mysql_real_escape_string($_POST[$var]);
    }

?>
该网页显示正常,但是一按ADD RECODE按钮就会出现Object Not Found错误,并且底下有Error 404。
求大神帮忙呢。。。
------解决思路----------------------
加断点一步一步调试。
------解决思路----------------------

sqltext.php 這個文件有嗎?


------解决思路----------------------
sqltext.php 存在吗?
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn