Code: Select all
<?php
include('includes/header01.html');
include('includes/breed.inc.php');
if ( (isset($_GET['dad'])) && (is_numeric($_GET['dad'])) && (isset($_GET['mom'])) && (is_numeric($_GET['mom']))) { //from create_horse.php
$momhorseid = $_GET['mom'];
$dadhorseid = $_GET['dad'];
$q = "SELECT color, height, temperament, confirmation, movement, understanding, confidence, strength FROM horses WHERE horse_id='$momhorseid'";
$r = @mysqli_query ($dbc, $q); // Run the query.
while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {
$momcolor = $row['color'];
$momheight = $row['height'];
$momtemp = $row['temperament'];
$momconfo = $row['confirmation'];
$mommovement = $row['movement'];
$momunder = $row['understanding'];
$momconfi = $row['confidence'];
$momstrength = $row['strength'];
}
$q = "SELECT color, height, temperament, confirmation, movement, understanding, confidence, strength FROM horses WHERE horse_id='$dadhorseid'";
$r = @mysqli_query ($dbc, $q); // Run the query.
while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {
$dadcolor = $row['color'];
$dadheight = $row['height'];
$dadtemp = $row['temperament'];
$dadconfo = $row['confirmation'];
$dadmovement = $row['movement'];
$dadunder = $row['understanding'];
$dadconfi = $row['confidence'];
$dadstrength = $row['strength'];
}
/******************FUNCTIONS ARE HERE*******************
$q = "INSERT INTO horses (dad_id, mom_id, user_name, color, height, speed, temperament, confirmation, movement, understanding, confidence, talent, strength, gender, date_created) VALUES ('$dadhorseid', '$momhorseid', '{$_COOKIE['username']}', '$color', '$height', '$speed', '$temperament', '$confo', '$movement', '$understanding', '$confidence', '$talent', '$strength', '$gender', NOW())";
$r = mysqli_query ($dbc, $q) or trigger_error(mysqli_error($dbc));
if (mysqli_affected_rows($dbc) == 1) { // If it ran OK.
/*
$p = "INSERT INTO activeShow (horseID) VALUES (LAST_INSERT_ID())";
$t = mysqli_query($dbc, $p) or trigger_error(mysqli_error($dbc));
if (mysqli_affected_rows($dbc) == 1) { // If it ran OK.
echo 'Your horse is now in foal!';
} else { // If it did not run OK.
echo 'There was an error. Try again.';
}*/
} else {
echo 'There was an error. Try again later.';
}
} else {
echo 'This page has been accessed in error.';
}
include('includes/footer01.html');
?>