어떻게이 테이블을 3 개의 섹션으로 결합 할 수 있습니까? 시동기, 주전자 및 디저트를위한 것.php/MySQL - 제품 테이블을 함께 결합하는 방법
<?php
session_start();
$page = 'index.php';
mysql_connect('localhost','root','') or die(mysql_error());
mysql_select_db('cart') or die(mysql_error());
if (isset($_GET['add'])) {
$quantity = mysql_query('SELECT id, quantity FROM products WHERE id='.mysql_real_escape_string((int)$_GET['add']));
while ($quantity_row = mysql_fetch_assoc($quantity)) {
if ($quantity_row['quantity']!=$_SESSION['cart_'.(int)$_GET['add']]) {
$_SESSION['cart_' . (int)$_GET['add']] +='1';
header('Location: ' . $page);
}
}
header('Location: ' . $page);
}
if (isset($_GET['remove'])) {
$_SESSION['cart_'.(int)$_GET['remove']]--;
header ('Location: ' . $page);
}
if (isset($_GET['delete'])) {
$_SESSION['cart_' . (int)$_GET['delete']]='0';
header ('Location: ' . $page);
}
function products() {
$get = mysql_query('SELECT id, name, description, price FROM products WHERE quantity > 0 ORDER BY id DESC');
if (mysql_num_rows($get) == 0) {
echo "There are no products to display.";
}
else {
while ($get_row = mysql_fetch_assoc($get)) {?>
<center>
<table border=2 width=90% cellspacing=5 cellpadding=10 bgcolor=cyan cols=2>
<th>View</th>
<th>Dish</th>
<th>Description</th>
<th>Item Price</th>
<tr>
<td>
<a href="ice.png"</a>
</td>
<td>
<?echo '<p>'.$get_row['name']?>
</td>
<td>
<?echo $get_row['description']?>
</td>
<td>
<?echo '£'.number_format($get_row['price'],2).'<br><br> <a href="cart.php?add='.$get_row['id'].'">Add</a></p>';?>
</td>
</tr>
</table></center>
<?}
}
}
이 현재 표시 :
그러나 이상적으로 나는 항목에 대한 각각의 제목을 좋아하지 않을
여기에 지금까지 내 코드입니다!
단순히 HTML이 아니십니까? (모든 태그 대신)? –