Jump to content

Recommended Posts

I'm writing a script for an online breeding sim -- only I'm not sure how to make sure the numbers I'm getting are correct.



<?php<br />
//database queries<br />
$query=mysql_query("select hid,name from horses where gender='Mare' and age > 2");<br />
$num=mysql_num_rows($query);<br />
if($num == "0"){<br />
print "You have no mares older than two. Horses must be three or older to breed.";<br />
exit;<br />
}<br />
else {<br />
print "<form method=post action=breed.php?action=breed> Mare to cover: <select name=hid selected=selected><br />
while($i<3; $i=0; $i++){<br />
$row=mysql_fetch_array($query);<br />
print "<option value=$row[hid]>$row[name]</option></form>";<br />
}<br />
//variables<br />
$dadstats=array("Conformation"=>”$row[confirmation]”, "Intelligence"=>"$row[intelligence]", "Endurance"=>"$row[endurance]", "Strength"=>"$row[strength]", "Agility"=>"$row[agility]", "Speed"=>"$row[speed]");<br />
$momstats= array("Conformation"=>”$row[confirmation]”, "Intelligence"=>"$row[intelligence]", "Endurance"=>"$row[endurance]", "Strength"=>"$row[strength]", "Agility"=>"$row[agility]", "Speed"=>"$row[speed]");<br />
$dadcgenes=array("","");<br />
$momcgenes=array("","");<br />
$dadgenetics=array(“$row[bname]”,”$row[bname]”);<br />
$momgenetics=array(“$row[bname]”,”$row[bname]”);<br />
$foalstats=array("Conformation"=>"$v", "Intelligence"=>"$w", "Endurance"=>"$x", "Strength"=>"$y", "Agility"=>"$z", "Speed"=>"$a");<br />
$foalcgenes=array("", "");<br />
$foalgenetics=array(“t”,”t”);<br />
//beginning computations<br />
switch ($foalgenetics)<br />
{<br />
case Thoroughbred Quarter Horse:<br />
$foalgenetics=”Appendix QH”;<br />
break;<br />
case Arabian Apaloosa:<br />
$foalgenetics=”Ara-Apaloosa”;<br />
break;<br />
case Thoroughbred Arabian:<br />
$foalgenetics=”Anglo-Arabian”;<br />
$v=(($momstats[Conformation]+$dadstats[Conformation])*.70);<br />
$w=(($momstats[Intelligence]+$dadstats[Intelligence])*.70);<br />
$x=(($momstats[Endurance]+$dadstats[Endurance])*.70);<br />
$y=(($momstats[Strength]+$dadstats[Strength])*.70);<br />
$z=(($momstats[Agility]+$dadstats[Agility])*.70);<br />
$a=(($momstats[Speed]+$dadstats[Speed])*.70);<br />
array_splice($dadcgenes, 0,2,$foalcgenes);<br />
array_splice($momcgenes,1,2,$foalcgenes);<br />
array_splice($dadgenetics, 0,2,$foalgenetics);<br />
array_splice($momgenetics,1,2,$foalgenetics);<br />
<br />
echo $foalstats<br />
echo $foalcgenes<br />



How do I make sure that I the correct numbers from the mom's db entries versus the dad's? I know I should do something with the horses' ID #, but what and how?
Link to comment
https://forums.phpfreaks.com/topic/9895-differentiating-between-variables/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.