include ("./mysqli.php");
$mysql->query("
SELECT *
FROM category
ORDER by cat_id asc
");
while ($loop_1 = $mysql->fetch()) {
print_r($loop_1);
$mysql->query ("
SELECT idp,cat_id,product_name
FROM product
WHERE cat_id='$loop_1[cat_id]'
ORDER by idp asc
");
while ($loop_2 = $mysql->fetch()) {
print_r($loop_2);
}
}
include ("./mysqli.php");
$mysql->query("
SELECT *
FROM category
ORDER by cat_id asc
");
while ($loop_1 = $mysql->fetch()) {
print_r($loop_1);
$strSQL = "";
$strSQL = "SELECT idp,cat_id,product_name FROM product WHERE cat_id='$loop_1[cat_id]' ORDER by idp asc ";
$mysql1->query ($strSQL);
while ($loop_2 = $mysql1->fetch()) {
print_r($loop_2);
}
}
include ("./mysqli.php");
//$mysql->query("
$categories = $mysql->queryAndFetchAll("
SELECT *
FROM category
ORDER by cat_id asc
");
//while ($loop_1 = $mysql->fetch()) {
foreach ($categories as $loop_1) {
print_r($loop_1);
$mysql->query("
SELECT idp,cat_id,product_name
FROM product
WHERE cat_id='$loop_1[cat_id]'
ORDER by idp asc
");
while ($loop_2 = $mysql->fetch()) {
print_r($loop_2);
}
}