Gender? [answered]

Forum
Last Post
Threads / Messages

Arianna

Dev Staff
Staff member
Dev Staff
Joined
Sep 25, 2009
Messages
334
Points
0
Age
27
Mysidian Dollar
13,840
Being the PHP beginner that I am, I know I messed something up.
I added a new column to the owned_adoptables table, Gender. I had only one pet on the system, and I edited the myadopt action stats so that it showed the gender too.
I manually entered the gender via phpmyadmin, no big deal yet, because I have a problem which I encountered.
It will display the gender, but this seems to totally lock out any new adoptables. xP
How do I get around this? Also, if you know, how can I set it so on adoption it chooses either Female or Male (50/50 chance) and inserts it into the table?
Thanks,
Arianna


EDIT: I managed to make it so the default is female, and so it inserts that in - however, I'm stuck on how I can insert a random chance which chooses either 'Male' or 'Female' for the gender field.
 
RE: Gender?

You would need it to look for gender the same way it does for alts in the functions.. I realize you are new & trying.. but trust me on this one.. look closely at the functions page in the include foler.. find how it looks for alts & you will figure it out. :) I have faith :)

Sea
 
RE: Gender?

I found it out now :) My code was this, in the doadopt.php file:
Code:
//my gender mod

$tempgender = rand(0, 1);
if($tempgender == "0") {
$gender = "female";
unset($tempgender);
}
else {
$gender = "male";
unset($tempgender);
}
And then later I used the $gender variable to insert it in the sql query.
Thank goodness my dad knows computer programming, even if he doesn't know PHP. x3
 
Hello,

I am brisschris.This is my first visit to site.I am new to this site,but I’ve enjoyed posting in your forums.I know the PHP coding.You can use the functions.You can use this code.

$tempgender = rand(0, 1);
if($tempgender == "0")
{
$gender = "female";
unset($tempgender);
}
else
{
$gender = "male";
unset($tempgender);
}
This is the gender code.It is very help[ful to you.This is very best example.

Thank you very much and Stay connected with me.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,280
Messages
33,130
Members
1,603
Latest member
Monako
BETA

Latest Threads

Top