Simple questions...

Ok , Hello. I’m new here so if I’ve place this in the wrong area please forgive me.

First things first this project is a showcase for show animals. The database will hold everything from names, DOB, pedigrees, registration IDs, genetics, show results, life time earnings, progeny, and much more. At this current time I have a working registration form that will submit 34 pieces on information to the database, and display them on a page. I also have a proper admin panel for this project that will allow the editing of certain informations for each animal, as well as the removal/deletion of animals from the database. All’s good so far, but that is pretty much the extension of my understanding of PHP and SQL. In fact I’m surprised what I have so far is working with no errors… :-[

Now my first questions are: Is 34 fields large for one DB table considering i still have much more I need to add? Are there any problems that can occur with having really large tables?

Honestly I’d like to split my table ‘animals’ up so that I can organize my information. To help get a better understanding I’ll give you a rundown of my table ‘animals’:

RegID, Name, Origin, Breed, Gender, Color, Pattern, Sire, SiresDam, SiresSire, Dam, DamsDam, DamsSire, YoB, Height, Level, Training, Image, Status, BlackRed, Brown, Dilute1, Dilute2, Dilute3, Dilute4, White1, White2, Pattern1, Pattern2, Pattern3, Pattern4, Spots1, Spots2, Spots3.

Everthing from BlackRed to Spots3 is genetics that are filled in on the registration form. I would like for them to have their own table ‘genetics’, because I’m a little ocd about organization, but I’m not 100% confident the way I envision it would work.

As far as putting the information into two different tables, would it truly as simple as just splitting the registration up like this on the same page?

[php]$register=“INSERT into horses (RegID, Name, Origin, Breed, Gender, Color, Pattern, Sire, SiresDam, SiresSire, Dam, DamsDam, DamsSire, YoB, Height, Level, Training, Image, Status)
VALUES (‘$RegID’, ‘$Name’, ‘$Origin’, ‘$Breed’, ‘$Gender’, ‘$Color’, ‘$Pattern’, ‘$Sire’, ‘$SiresDam’, ‘$SiresSire’, ‘$Dam’, ‘$DamsDam’, ‘$DamsSire’, ‘$YoB’, ‘$Height, ‘$Level, ‘$Training, ‘$Image’, ‘Pending’)”;

$register="INSERT into genetics (RegID, Name, BlackRed, Brown, Dilute1, Dilute2, Dilute3, Dilute4, White1, White2, Pattern1, Pattern2, Pattern3, Pattern4, Spots1, Spots2, Spots3)
VALUES (‘$RegID’, ‘$Name’, ‘$BlackRed’, ‘$Brown’, ‘$Dilute1’, ‘$Dilute2’, ‘$Dilute3’, ‘$Dilute4’, ‘$White1’, ‘$White2’, ‘$Pattern1’, ‘$Pattern2’, ‘$Pattern3’, ‘$Pattern4’, ‘$Spots1’, ‘$Spots2’, ‘$Spots3’)[/php]

On my original table I put the primary index on the ID, and had a second index on the name field. When splitting the information into two tables should give both of the tables the same index’s?

Also if the above way of registering information to the DB is correct then in order to pull than information in an echo tag I’d need to this on the same page as well wouldn’t I?

[php]$get = “SELECT * FROM horses WHERE id=’$id’”;
$res = mysql_query($get) or die(‘Could not get id because’ . mysql_error());
while ($row = mysql_fetch_array ($res, MYSQL_ASSOC)) {

$id = $row[‘id’];
$name = $row[‘name’];
$breed = $row[‘breed’];
$gender = $row[‘gender’];
$yob = $row[‘yob’];
Ext…ext…ext…

$get = “SELECT * FROM genetics WHERE id=’$id’”;
$res = mysql_query($get) or die(‘Could not get id because’ . mysql_error());
while ($row = mysql_fetch_array ($res, MYSQL_ASSOC)) {

$id = $row[‘id’];
$name = $row[‘name’];
$ BlackRed = $row[‘BlackRed’];
$ Brown = $row[‘Brown’];
$ Dilute1 = $row[‘Dilute1’];
Ext…ext…ext…[/php]

if neither of those is correct could one be so kind as to point me in the right direction of displaying two tables worth of data, or just letting me know if I need to settle for one massive table…

I’m am sorry for the long post, but i felt it was better if i lumped all my questions into one post rather than posting several times.

Sponsor our Newsletter | Privacy Policy | Terms of Service