我想知道是否有人可以帮助我,因为我被卡住了:)脚本无法正常工作:/
获取“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>";
}
}
?>