baza wyglada tak:
-- Baza danych: `itsolution`
--
-- --------------------------------------------------------
--
-- Struktura tabeli dla `categories`
--
CREATE TABLE `categories` (
`category_id` int(11) NOT NULL AUTO_INCREMENT,
`category` varchar(32) DEFAULT NULL,
PRIMARY KEY (`category_id`)
) TYPE=MyISAM AUTO_INCREMENT=9 ;
--
-- Zrzut danych tabeli `categories`
--
INSERT INTO `categories` VALUES (1, 'Microsoft Windows');
INSERT INTO `categories` VALUES (2, 'Linux/Unix');
INSERT INTO `categories` VALUES (3, 'Software');
INSERT INTO `categories` VALUES (4, 'Hardware');
INSERT INTO `categories` VALUES (5, 'Sieci');
INSERT INTO `categories` VALUES (6, 'Wirusy');
INSERT INTO `categories` VALUES (7, 'IT Solution');
INSERT INTO `categories` VALUES (8, 'Inne');
-- --------------------------------------------------------
--
-- Struktura tabeli dla `comments`
--
CREATE TABLE `comments` (
`comment_id` int(11) NOT NULL AUTO_INCREMENT,
`news_id` int(11) DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
`comment` text,
PRIMARY KEY (`comment_id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
--
-- Zrzut danych tabeli `comments`
--
-- --------------------------------------------------------
--
-- Struktura tabeli dla `news`
--
CREATE TABLE `news` (
`news_id` int(11) NOT NULL AUTO_INCREMENT,
`heading` varchar(48) DEFAULT NULL,
`body` text,
`date` date DEFAULT NULL,
`author_name` varchar(32) DEFAULT NULL,
`author_email` varchar(64) DEFAULT NULL,
PRIMARY KEY (`news_id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
--
-- Zrzut danych tabeli `news`
--
-- --------------------------------------------------------
--
-- Struktura tabeli dla `news2`
--
CREATE TABLE `news2` (
`news_id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(32) DEFAULT NULL,
`intro` text,
`more` text,
`author_id` int(11) DEFAULT NULL,
`category_id` int(11) DEFAULT NULL,
`date` date DEFAULT NULL,
`time` time DEFAULT NULL,
PRIMARY KEY (`news_id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
--
-- Zrzut danych tabeli `news2`
--
czuje ze chodzi oto:
<?php
$cat_result = mysql_query("select categories.category from helpdesk, categories where helpdesk.categor
y_id = categories.category_id and helpdesk.category_id = '$cat_num'"); ?>
Ten post edytował touse 12.01.2007, 11:58:09