Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/63.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_Mysql_Html Table - Fatal编程技术网

Php 正在从数据库中提取数据,工作不正常

Php 正在从数据库中提取数据,工作不正常,php,mysql,html-table,Php,Mysql,Html Table,我想知道是否有人能帮我,因为我被卡住了:脚本无法正常工作:/ Naam中的记录被提取、循环并显示表格: 但该产品的数据并未显示。所以我的观点是:有人能帮我从数据库获取产品数据吗,提前谢谢 <?php require_once('Includes/connect.php') ?> <?php if(isset($_GET['action']) &

我想知道是否有人能帮我,因为我被卡住了:脚本无法正常工作:/

Naam中的记录被提取、循环并显示表格: 但该产品的数据并未显示。所以我的观点是:有人能帮我从数据库获取产品数据吗,提前谢谢

                <?php

            require_once('Includes/connect.php')

            ?>

            <?php

            if(isset($_GET['action']) && $_GET['action']=="add"){

            $id=intval($_GET['id']);

            if(isset($_SESSION['cart'][$id])){

            $_SESSION['cart'][$id]['quantity']++;

            }else{

            $sql_s="SELECT * FROM product
            WHERE id_product={$id}";
            $query_s=mysql_query($sql_s);
            if(mysql_num_rows($query_s)!=0){
            $row_s=mysql_fetch_array($query_s);

            $_SESSION['cart'][$row['id_product']]=array(
            "quantity" => 1,
            "price" => $row['price']
            );

            }
            else
            {
            $message="Het product ID is ongeldig!";
            }
            }
            }

            echo "<h1>Producten lijst Kerstbomen</h1>";

            if(isset($message))
            {
            echo "<h2>$message</h2>";
            }
            else
            {

            $table_thead = '
            <table>
            <tr>
            <th><ID/th>
            <th>Id produkt</th>
            <th>size</th>
            <th>diameter</th>
            <th>tips</th>
            <th>nr_of_bulb</th>
            <th>cu_ft</th>
            <th>l</th>
            <th>w</th>
            <th>h</th>
            <th>cbm</th>
            <th>g_w</th>
            <th>n_w</th>
            <th>stand</th>
            <th>pack</th>
            <th>warehouse</th>
            <th>Price</th>
            <th>barcode</th>
            <th>Quantity</th>
            </tr>
            ';


            $sql_getName = "
            SELECT *
            FROM naam
            ORDER BY name ASC
            ";

            $query_getName = mysql_query($sql_getName);


            while( $row_name = mysql_fetch_assoc($query_getName) )
            {

            $curName = $row_name['name'];


            $sql_getProduct = "
            SELECT *
            FROM product
            WHERE id_name = '$name';
            ";

            $query_getProduct = mysql_query($sql_getProduct);


            echo ($row['id_name']);



            print $table_thead;


            while( $row_Product = mysql_fetch_assoc($query_getProduct) )
            {
             echo "
            <tr>
            <td> ".$row['id_product']."</td>
            <td>".$row['size']."</td>
            <td>".$row['diameter']."</td>
            <td>".$row['tips']."</td>
            <td>".$row['nr_of_bulb']."</td>
            <td>".$row['cu_ft']."</td>
            <td>".$row['l']."</td>
            <td>".$row['w']."</td>
            <td>".$row['h']."</td>
            <td>".$row['cbm']."</td>
            <td>".$row['g_w']."</td>
            <td>".$row['n_w']."</td>
            <td>".$row['stand']."</td>
            <td>".$row['pack']."</td>
            <td>".$row['warehouse']."</td>
            <td>".$row['price']."</td>
            <td>".$row['barcode']."</td>
            <td>".$row['id_name']."</td>
            <td> <b></b> <input class='quantity' type= 'text' name='aantal' size='2' maxlength='2' value='1'/></td>
            <td><a href='index.php?page=product&action=add&id=".$row['id_product']."'>Product toevoegen</a></td>
            </tr>";

            }


            echo "</table>";
            }
            }
            ?>

$row['id\U product']应该是$row\U product['id\U product']对吗?。它们不再得到维护。看到了吗?相反,学习,并使用or-将帮助您决定哪一个。如果您选择PDO,谢谢您的建议