MySQL Forums
Forum List  »  Serbian/Croatian/Bosnian

Diplomski
Posted by: Dino Kant
Date: June 11, 2009 06:47AM

Ljudi imam problem za diplomski

Radim databazu za unos tendera i tabelu sa statusima. Svaki tender je u jednom od 5 mogucih statusa (ponudjeno, ne nuditi, ugovor sklopljen) itd. Eh sad fora je sto kada unosim tendere, javlja mi da je failed foreign key constraint. U tabeli tenderi status je foreign key vezan za primary key u tabeli statusi tj StatusID. Taj status ID ima neke vrijednosti ali kad god hocu da ga unesem javi mi tu gresku, ne kontam. Druga stvar je sto ako u formu unesem status ponudjen radi, ali svaki drugi status ne radi, cak i kad promijenim polje ponudjen ne radi, a kad ga vratim opet radi, bas ne kontam dje je zapelo. Ev ispod ide mysql dump mog koda (koji sam uglavnom radio u phpmyadminu, s tim da sam kad sam pravio stranicu programiro nest u phpu pa ako kome bude trebalo postavicu i to al cisto sumnjam da je u tome problem jer mi druga polja koja su skoro pa ista (tipa valuta) rade sasvim ok)


CREATE DATABASE /*!32312 IF NOT EXISTS*/`dino` /*!40100 DEFAULT CHARACTER SET latin1 */;

USE `dino`;

/*Table structure for table `status` */

DROP TABLE IF EXISTS `status`;

CREATE TABLE `status` (
`Namjena` varchar(50) DEFAULT NULL,
`Zapisano` datetime DEFAULT NULL,
`Promjena` datetime DEFAULT NULL,
`StatusID` enum('Ponuda napravljena','ne nuditi','isteko rok','ponuda prihvacena','sklopljen ugovor') NOT NULL DEFAULT 'Ponuda napravljena',
PRIMARY KEY (`StatusID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC;

/*Data for the table `status` */

insert into `status`(`Namjena`,`Zapisano`,`Promjena`,`StatusID`) values ('Ponuda napravljena za Tender','2009-06-14 23:11:21','2009-06-15 23:11:23','Ponuda napravljena'),('Na tender se nece nuditi','2009-06-14 23:11:41','2009-06-28 23:11:44','ne nuditi');

/*Table structure for table `tenderi` */

DROP TABLE IF EXISTS `tenderi`;

CREATE TABLE `tenderi` (
`TenderID` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`RedniBroj` smallint(5) unsigned NOT NULL,
`BrProtTend` varchar(50) NOT NULL,
`ImeTendera` varchar(100) NOT NULL,
`Predmet` varchar(255) DEFAULT NULL,
`DatumLicitacije` date DEFAULT NULL,
`PosebniKriteriji` varchar(255) DEFAULT NULL,
`UsloviPlacanja` varchar(255) DEFAULT NULL,
`ProcjenaVrijednosti` float DEFAULT NULL,
`LicitacionaGarancija` float DEFAULT NULL,
`OpcijaLG` varchar(2) DEFAULT NULL,
`Valuta` enum('KM','$','EUR') DEFAULT NULL,
`Paritet` float DEFAULT NULL,
`Lokacija` varchar(255) DEFAULT NULL,
`IzvedGaranc` float DEFAULT NULL,
`AvansnaGarancija` float DEFAULT NULL,
`KomitentID` smallint(6) DEFAULT NULL,
`Drzavaid` enum('BIH','USA','HRV','SRB','SLO') DEFAULT NULL,
`InvestitorID` smallint(6) DEFAULT NULL,
`NosiocPoslaID` varchar(50) DEFAULT NULL,
`OstaliUcesnici` varchar(255) DEFAULT NULL,
`Telefon` varchar(50) DEFAULT NULL,
`Kontakt` varchar(200) DEFAULT NULL,
`Zapisano` datetime DEFAULT NULL,
`Promjena` datetime DEFAULT NULL,
`RatingTendera` enum('1','2','3','4','5') NOT NULL,
`Odlozeno` varchar(50) DEFAULT NULL,
`Status` enum('ponudjen','ne nuditi','isteko rok','ponuda prihvacena','sklopljen ugovor') DEFAULT NULL,
PRIMARY KEY (`TenderID`),
UNIQUE KEY `RedniBroj` (`RedniBroj`),
KEY `NosiocPoslaID` (`NosiocPoslaID`),
KEY `Valuta` (`Valuta`),
KEY `FK_tenderi` (`KomitentID`),
KEY `Status` (`Status`),
CONSTRAINT `tenderi_ibfk_4` FOREIGN KEY (`Status`) REFERENCES `status` (`StatusID`),
CONSTRAINT `FK_tenderi` FOREIGN KEY (`KomitentID`) REFERENCES `komitenti` (`KomitentID`),
CONSTRAINT `tenderi_ibfk_1` FOREIGN KEY (`NosiocPoslaID`) REFERENCES `nosiocposla` (`NosiocPoslaID`),
CONSTRAINT `tenderi_ibfk_3` FOREIGN KEY (`Valuta`) REFERENCES `kursnalista` (`ValutaID`)
) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=latin1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC;

/*Data for the table `tenderi` */

Options: ReplyQuote


Subject
Views
Written By
Posted
Diplomski
7829
June 11, 2009 06:47AM
5874
June 11, 2009 09:47AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.