Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/281.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 试图显示数据库中的数字时未定义索引_Php - Fatal编程技术网

Php 试图显示数据库中的数字时未定义索引

Php 试图显示数据库中的数字时未定义索引,php,Php,我试图显示我的数据库中的isbn号,当他们单击另一页的图像时,出于某种原因,我一直收到这个错误 注意:未定义索引:第8行isbn <html><title>Employee List</title> <head></head> <body> <h1> List of Employees </h1> <

我试图显示我的数据库中的isbn号,当他们单击另一页的图像时,出于某种原因,我一直收到这个错误

注意:未定义索引:第8行isbn

            <html><title>Employee List</title>  <head></head>
            <body>
            <h1> List of Employees </h1>
            <?php
            require_once("include/db_connect.php");
            $db_link = db_connect("project");

            $isbn = $_REQUEST['isbn'];

            $query = "SELECT * FROM bookstore WHERE isbn = '$isbn'";

            $result = mysql_query($query);

                    if ($row = mysql_fetch_assoc($result)) {
                     $isbn = $row['isbn'];

                    echo "<tr><td><strong>Isbn:</strong>". $isbn. "</td>";

            }

            ?>
            </body>
            </html>
我的php程序的主程序

            <?php require_once("include/db_connect.php"); ?>
            <html>
            <head><title>Displaying Image files using PHP</title></head>
            <body>
            <h1>Bookworms Booksite</h1>

                    <style> @import "css/style.css";</style>


                <div id = "nav">
                        <ul>
                        <li><a class = "navbutton" href="index.html">Home</a></li>
                        <li><a class = "navbutton" href="membership.html">Books</a></li>
                        <li><a class = "navbutton" href="classes.html">Shopping Cart</a></li>
                        <li><a class = "navbutton" href="">Checkout</a></li>
                        <li><a class = "navbutton" href="shop.html" id ="current" >About</a></li>

                        </ul>
                    </div>

                    <p></p>
                    <p></p>

                 <div id = "sideNav">
                    <ul>
                    <li><a href="#home">Enter Bookstore</a></li><br>
                    <li><a href="#news">Bookstore Administartion</a></li><br>
                    <li><a href="#contact">Search</a></li>
                    </ul>
                 </div>


                            <?php


                            $db_link = db_connect("project");

                            // Retrieve table properties

                            $fields = mysql_list_fields("project", "bookstore");
                            $num_columns = mysql_num_fields($fields);

                            // Make a simple database query to select all columns and rows

                            $query = "SELECT * FROM bookstore";
                            $result = mysql_query($query) or die("SQL query failed");

                            // Display results as an HTML table. Note how mysql_field name
                            // uses the $fields object to extract the column names

                            echo '<table border="1" cellpadding = "5" >';

                            // Display the column names

                            echo "<tr>";



                            echo "</tr>";

                            // Loop over the rows of the table.
                            // $row contains the information for each row
                            // Refer to the names of the fields in the table
                            // Must ahow the path where the image files are held

                            while ($row = mysql_fetch_assoc($result))
                            {
                               echo "<tr>";
                               $isbn = $row['isbn'];
                               $title = $row['title'];

                               echo "<td><a href='bookDetail.php'><img src = 'images/". $row['image']. "'></a></td>";
                               echo "<a href='bookDetail.php? id= ". $isbn . "'>". $title . "</a><br/>";
                                                  echo "<td>". $row['isbn']."</td>";

                               echo "<td>". $row['title']."</td>";
                               echo "<td>". $row['author']."</td>";
                               echo "<td>". $row['pub']."</td>";
                               echo "<td>". $row['year']."</td>";
                               echo "<td>". $row['price']."</td>";


                               echo "</tr>";

                            }
                            echo "</table>";

                            // Free the resources and close the connection

                            mysql_free_result($result);
                            mysql_close($db_link);
                            ?>
            </body>
            </html>
第8行是这样的:

$isbn = $_REQUEST['isbn'];
因此,您的$\u请求['isbn']变量未定义。执行打印请求;检查您的请求参数

要使用$_REQUEST['isbn',您需要表单调用该页面,并且需要一个名为='isbn'的字段,否则它将不存在


关于表单的更多信息:

实际上第8行是$u请求['isbn'];这与数据库无关。您确定要将参数传递到页面吗?

显示bookstore Descripte bookstore的表结构。它表示此now数组[id]=>0-12-066190-2是,表示您的表单没有将“isbn”参数传递到页面。因此,您无法获取它以将其放入查询中。我们需要您的其余代码来提供更多帮助。要获取$\u REQUEST['isbn']变量,您需要在调用方页面的表单中有一个name='isbn'字段。您显示的代码没有格式。