Page 1 of 1

Halfsibling - same mother????

Posted: Fri Jul 28, 2006 8:03 am
by Apophis
Everah | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi,

I am trying to build a database (and that works fine) but i want to have an output when i ask for excample "Halfsibling - same mother:"

details of the database:

[syntax="sql"]CREATE TABLE `dog_table` (
`Id` int(11) NOT NULL auto_increment,
`DogRegis` varchar(30) default NULL,
`DogName` varchar(50) default NULL,
`DogTitle` varchar(60) default NULL,
`Callname` varchar(20) default NULL,
`DOB` date default NULL,
`DOD` date default NULL,
`Gender` varchar(20) default NULL,
`Color` varchar(20) default NULL,
`FatherId` int(11) default NULL,
`MotherId` int(11) default NULL,
`WrightCoef` varchar(20) default NULL,
`CountryOrig` varchar(20) default NULL,
`Kennel` varchar(20) default NULL,
`Breeder` varchar(20) default NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `DGPrimRegNbr` (`DogRegis`,`DogName`)
) ENGINE=MyISAM
Can some one help me with a script for displaying halfsiblings - same mother??

Thanks for the help.


Everah | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Fri Jul 28, 2006 11:18 am
by Ollie Saunders
what's stopping you assigning two entires in dog_table to the same MotherId?

Posted: Fri Jul 28, 2006 11:41 am
by Apophis
assigning two entries to the table with the same MotherId is not a problem. I can't get it wright to get an output of the dogs ho have the same mother. :wink:

Posted: Fri Jul 28, 2006 12:02 pm
by Ollie Saunders

Code: Select all

SELECT  * FROM dog_table WHERE MotherId = 3
Can return any number of rows

Posted: Fri Jul 28, 2006 12:38 pm
by Apophis
This is the page of my dog.

http://www.wanyika.be/pedigree/pedigree ... 7036&Gen=4

My dog is having a mother with a id of 2191.

Code: Select all

SELECT * FROM `dog_table` WHERE `MotherId` = 2191 ORDER BY DogName ASC 
this works perfect with mysql.
Below of that page i want to have a link, if i thake that it most know what mother and display the result. How do i do that with PHP

Posted: Fri Jul 28, 2006 1:04 pm
by Ollie Saunders
Sorry I can't understand, please rephrase your question.

Posted: Fri Jul 28, 2006 1:11 pm
by RobertGonzalez
Moved to Databases.

Problem solved

Posted: Sun Jul 30, 2006 9:17 pm
by Apophis
No help needed. I have solved the problem after a good night sleep.

Posted: Sun Jul 30, 2006 11:37 pm
by RobertGonzalez
Mind sharing your solution so others can benefit from your fervent efforts? And please edit your original post title and add '[SOLVED] - ' to the beginning. Thanks.