Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/277.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_Html_Mysql - Fatal编程技术网

Php 向表中添加单选按钮时查询不完整

Php 向表中添加单选按钮时查询不完整,php,html,mysql,Php,Html,Mysql,我试图在我的PHP文件中创建一个“编辑记录”函数,您可以使用单选按钮编辑一行 我的桌子“书”里面有15条记录。它工作正常,但当我在数据库中添加一行时,它会出现故障并显示: 数据不完整的表格 没有按钮 500服务器错误(很少) 我是PHP新手,正在自学函数和语法。任何帮助都将不胜感激:) 这是我的PHP代码: <?php include 'config.php'; session_start(); $sql = "SELECT * from book"; $result = mysqli

我试图在我的PHP文件中创建一个“编辑记录”函数,您可以使用单选按钮编辑一行

我的桌子“书”里面有15条记录。它工作正常,但当我在数据库中添加一行时,它会出现故障并显示:

  • 数据不完整的表格
  • 没有按钮
  • 500服务器错误(很少)
  • 我是PHP新手,正在自学函数和语法。任何帮助都将不胜感激:)

    这是我的PHP代码:

    <?php
    include 'config.php';
    
    session_start();
    
    $sql = "SELECT * from book";
    $result = mysqli_query($db, $sql);
    $count = mysqli_num_rows($result);
    
    if($count == 0){
        $error = "There is no books in the list";
    
    }
    
    <html>
    <body>
    <form method="post" action="editinfo.php">
    
        <table border="1" style="width:80%" align="center">
            <tr>
                <th>Edit</th>
                <th>ISBN</th>
                <th>Title of the book</th>
                <th>Cost</th>
                <th>Copies</th>
                <th>Edition</th>
                <th>Publisher</th>
                <th>Copy Year</th>
                <th>Shelf Number</th>
                <th>Subject</th>
    
            </tr>
            <?php while ($row = mysqli_fetch_array($result)) {
    
                $ISBN = $row['ISBN'];
                $Title = $row['Title'];
                $Cost = $row['Cost'];
                $Copies = $row['Copies'];
                $Edition = $row['Edition'];
                $Publisher = $row['Publisher'];
                $CopyYr = $row['CopyYr'];
                $Shelf = $row['ShelfNo'];
                $Subject = $row['SubName'];
    
                ?>
                <tr>
                    <td><input name="editradio" type="radio" value="<?php echo $ISBN; ?>" checked></td>
                    <td><?php echo $ISBN; ?></td>
                    <td><?php echo $Title; ?></td>
                    <td><?php echo $Cost; ?></td>
                    <td><?php echo $Copies; ?></td>
                    <td><?php echo $Edition; ?></td>
                    <td><?php echo $Publisher; ?></td>
                    <td><?php echo $CopyYr; ?></td>
                    <td><?php echo $Shelf; ?></td>
                    <td><?php echo $Subject; ?></td>
                </tr>
    
                <?php
            }
            ?>
        </table>
        <br>
        <table align="center" style="width:20%">
            <tr>
                <th><input type="submit" name="editinfo" value="Edit Selected"></th>
    </form>
    <form action="bookslist.php" method="post">
        <th><input type="submit" value="Back"/></th>
    </form>
    </tr>
    </table>
    <br>
    </body>
    </html>
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `book`
    --
    
    CREATE TABLE `book` (
      `ISBN` varchar(14) NOT NULL,
      `Title` varchar(50) NOT NULL,
      `Cost` decimal(5,2) NOT NULL,
      `Copies` int(10) NOT NULL,
      `Edition` int(15) NOT NULL,
      `Publisher` varchar(30) NOT NULL,
      `CopyYr` int(8) NOT NULL,
      `ShelfNo` int(11) NOT NULL,
      `SubName` varchar(50) NOT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    
    --
    -- Dumping data for table `book`
    --
    
    INSERT INTO `book` (`ISBN`, `Title`, `Cost`, `Copies`, `Edition`, `Publisher`, `CopyYr`, `ShelfNo`, `SubName`) VALUES
    ('0123704901', 'Computer Architecture: A Quantitative Approach', '24.95', 10, 4, 'Morgan Kaufmann', 2006, 11, 'ICT'),
    ('0123944244', 'Digital Design and Computer Architecture', '52.57', 10, 2, 'Morgan Kaufmann', 2012, 11, 'ICT'),
    ('0124077269', 'Computer Organization and Design', '75.74', 10, 5, 'Morgan Kaufmann', 2013, 13, 'ICT'),
    ('0205973361', 'Psychology', '158.53', 10, 4, 'Pearson', 2014, 14, ''),
    ('0321696867', 'University Physics with Modern Physics', '225.76', 10, 13, 'Addison-Wesley', 2011, 12, 'Science'),
    ('0321740904', 'Physics for Scientists and Engineers: A Strategic ', '228.16', 10, 3, 'Addison-Wesley', 2012, 15, 'Science'),
    ('0321884078', 'Thomas'' Calculus: Early Transcendentals', '198.89', 10, 13, 'Pearson', 2013, 12, 'Mathematics'),
    ('0470879521', 'Physics', '209.38', 10, 9, 'John Wiley and Sons', 2012, 11, 'Science'),
    ('0596802358', 'Data Analysis with Open Source Tools', '26.69', 10, 1, 'O''Reilly Media', 2010, 14, 'ICT'),
    ('099040207X', 'SQL Database for Beginners', '22.49', 10, 1, 'LearnToProgram, Incorporated ', 2014, 15, 'ICT'),
    ('1285057090', 'Calculus', '245.84', 10, 10, 'Cengage Learning', 2013, 13, 'Mathematics'),
    ('1429261781', 'Psychology', '152.54', 10, 10, 'Worth Publishers', 2011, 14, ''),
    ('1449600069', 'The Essentials of Computer Organization and Archit', '215.95', 10, 3, 'Jones & Bartlett Learning', 2010, 11, 'ICT'),
    ('1452257876', 'Qualitative Data Analysis: A Methods Sourcebook', '72.42', 10, 3, 'SAGE Publications, Inc', 2013, 12, 'ICT'),
    ('1590597699', 'Beginning Database Design: From Novice to Professi', '25.83', 10, 1, 'Apress', 2007, 15, 'ICT');
    
    -- --------------------------------------------------------
    

    另外,请添加代码,您可以在其中编辑和上载新文件row@skeeedrow提交后,您将转发到正在运行的路径,然后出现问题。@Shinratensei将为无线电分配一个值。错了吗?我是新手PHP@Shinratensei错误是当我使用select语句检索表时。编辑功能没有问题