How do I only show info posted from tables to one single person? I'm making a dog simulation (like furry-paws.com) and users can create a dog, and it gets put on the kennel page, but only their dogs are supposed to be displayed and instead everyones dogs are shown.

I talked with someone and they told me I needed kennel to have variables in them, so depending on the variable (the userid number of the person in the table canines, not the table players) it would display only dogs they made. so like doggame.com/kennel.php?userid=somenumberhere. So would it be like, SELECT * FROM dogs WHERE userid='$userid' for the script on the kennel page? My question is, would I need to make it so that userid in the table dogs, and id in the table players is linked, how would I do this. I'm really confused.

What I'm supposed to be doing with userid (canine table) and id (player table) is really confusing. I think I need to have them linked, but I'm not sure?

Also, probably an easier question to understand (I'm not good at explaining my questions :o) is how do I get random breeds? I need it to generate a certain amount of dogs at midnight, and they're going to be mixed breeds. How do I get it to randomly choose from a list of choices, and enter those two breeds it's mixed of into 2 fields, breed1 and breed2? Also, how would I get it to do this at 12 each night?

    ok, I figured out userid on my own.

    $userid = $_SESSION['id'];

    I feel stupid now. But since I've only been doing PHP for a week now I guess its a big deal for me.

    I still need help with the random breed thing and setting it to run at 12

      Write a Reply...