I THINK I MISS THE WHOLE CODE TO MAKE MY PROBLEM SOLVE...BY THE TNX FOR YOUR COOPERATION....ANYWAY HERE'S THE WHOLE CODE COZ IT SEEMS THAT THE CODE YOU'VE GIVEN TO ME I COUDN'T HANDLE TO THE RIGHT PATH TO MAKE IT CORRECT
THE CODE:
<?php
//connect to MySQL
$connect = mysql_connect("localhost", "root", "") or die ("Hey loser, check your server connection.");
//make sure weâre using the right database
mysql_select_db ("contents");
$querycats="SELECT CATEGORY,
ID_CATEGORY
FROM categories"; // Query to select all the categories to search all the items by using ID_CATEGORY variable.
$results=mysql_query($querycats)or die(mysql_error());
while ($rows = mysql_fetch_array($results)) {
echo "<br>\n";
extract($rows);
$searchcat = $ID_CATEGORY; //declaring variable for to get every corresponds value
echo "<li>$CATEGORY</li>"; //display the category
echo "<br>\n";
}
$queryitems="SELECT
DESCRIPTION,
QUANTITY
FROM items
WHERE ID_CATEGORY = '$searchcat'"; // Query to select all items....
//getting the value of every ID_CATEGORY it corresponds the specifi items
// this query implies to display items
$results2=mysql_query($queryitems)or die(mysql_error());
while ($items = mysql_fetch_array($results2)) {
extract($items);
echo "\n$DESCRIPTION\n \n$QUANTITY"; // display the description and the quantity//// HOW TO MAKE AN SPACE BETWEEN DESCRIPTION AND QUANTITY
echo "";
echo "<br>";
}
}
?>
THANKS
|