Jump to content

s3recap

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Everything posted by s3recap

  1. Im new to php trying to edit scripts and what not. Well basically Im trying to pull a certain number thats stored in my database. id name image game pet_desc pet_strength 12144 Werewolf 1 Rawr 0 12143 Zombie 1 Living dead 0 12142 Human 1 The average human. 0 12145 Vampire 1 I like blood 0 12146 Wizard 1 magic! 0 12147 Doggy Test 1 dgdfgdfgdgf 255 Im trying to get the specific number of 255. So when a user creates this character their strenght would be 255. <?php /* Process adoption (getpet.pro.php) */ ob_start(); $rank_check = 1; include "global.inc.php"; $findGetFirsts = fetch("SELECT * FROM pets2 WHERE game = '$game' AND id = '$species'"); $pet_str = fetch("SELECT $pet_strength FROM pets2 WHERE name = '$species'"); if (!$findGetFirsts[id]) { die(header(error("getpet.php?game=$game","Select a real pet."))); } if ($findGetFirsts[starter] == 0) { die(header(error("getpet.php?game=$game","Select a starter pet."))); } $num_pets = mysql_num_rows(mysql_query("SELECT * FROM user_pets2 WHERE owner = '$userid' AND game = '$game'")); if ($num_pets != 0) { die(header(error("index.php?game=$game","You already have a pet."))); } $check = fetch("SELECT * FROM user_pets2 WHERE name = '$petname' AND game = '$game'"); if ($check[name]) { die(header(error("getpet.php?game=$game&pet=$species","There is already a pet with that name. Try another name."))); } if ($petname == "") { die(header(error("getpet.php?game=$game&pet=$species","Don't leave the name blank."))); } if (preg_match('/^[a-zA-Z0-9_]*$/UD',$petname)) { mysql_query("INSERT INTO user_pets2 (name,species,owner,level,strength,intelligence,speed,hunger,timestamp,defense,current_hp,max_hp,game) VALUES ('$petname','$species','$userid','1','$pet_str','7','7','7','$timestamp','7','100','100','$game')"); } else { die(header("Location: $base_url/getpet.php?game=$game&error=" . space2plus("Your pet's name can only contain a-z, A-Z, 0-9 and underscores. Please try again."))); } die(header(error("mypets.php?game=$game","Congratulations, your new pet is named $petname."))); ?> $pet_str = fetch("SELECT $pet_strength FROM pets2 WHERE name = '$species'" i know its probably wrong but thats what i added.
×
×
  • 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.