Jump to content

DeanWhitehouse

Members
  • Posts

    2,527
  • Joined

  • Last visited

Everything posted by DeanWhitehouse

  1. try $sql = "SELECT * FROM `forum` WHERE `ParentID` = '1'";
  2. If you change what i said, and you are showing all the code then you won't. It would show another error and stop the rest of the page running. Show your current code.
  3. $result=mysql_query($sql); to $result=mysql_query($sql) or die(mysql_error());
  4. echo "<img src=\"logo.jpg\" border=\"0\" align=\"left\"></img>"; should be echo "logo.jpg";
  5. Your sql query is wrong, post it here or we can't help.
  6. You need to do something like <?php $sql = mysql_query("SELECT posts FROM km_users WHERE playername = '$player'"); $sql = mysql_fetch_assoc($sql); $posts = $sql['posts']; $sql = mysql_query("UPDATE km_users SET posts = '".($posts + 1)."' WHERE playername = '$player'"); ?>
  7. Another problem, most of the tables in the query have the same column names How do i properly reference them later on?
  8. They are I found the problem, in the big query using the joins not all the tables have anything in therefore it will return no results :s
  9. Also to find out why you got that error and why it is good read through this sites security tutorial.
  10. Can you use a query that uses an inner join and still loop through the rows. Here is my attempt <?php $query = mysql_query("SELECT * FROM city ORDER BY city DESC"); while($row = mysql_fetch_assoc($query)) { $sql = " SELECT blackjack.max_bet,blackjack.owner_id,blackjack.city_id, coinflip.max_bet,coinflip.owner_id,coinflip.city_id, keno.max_bet,keno.owner_id,keno.city_id, roulette.max_bet,roulette.owner_id,roulette.city_id, slots.max_bet,slots.owner_id,slots.city_id, war.max_bet,war.owner_id,war.city_id, airport.crew_id,airport.id, bulletfactory.crew_id,bulletfactory.price,bulletfactory.city_id, ironworks.price,ironworks.crew_id,ironworks.city_id FROM blackjack INNER JOIN coinflip ON coinflip.city_id = '".$row['id']."' INNER JOIN keno ON keno.city_id = '".$row['id']."' INNER JOIN roulette ON roulette.city_id = '".$row['id']."' INNER JOIN war ON war.city_id = '".$row['id']."' INNER JOIN slots ON slots.city_id = '".$row['id']."' INNER JOIN bulletfactory ON bulletfactory.city_id = '".$row['id']."' INNER JOIN airport ON airport.id = '".$row['id']."' INNER JOIN ironworks ON ironworks.city_id = '".$row['id']."' "; $sql = mysql_query($sql) or die(mysql_error()); while($rw = mysql_fetch_assoc($sql)) { print_r($rw); } } ?> That prints nothing :s
  11. It is finished, ignore the betting and the random names that appear. Does it play ok for everyone, good points, bad points ?
  12. Ok, then you could just do This way it will only remove the word if it is on its own, this way you won't need a word list of allowed words <?php function SwearFilter($str) { $swearwords = array("arse", "ass", "bitch"); $replacement = "<span class='badwords'>[censored]</span>"; return str_ireplace(" ".$swearwords." ",$replacement,$str); } if (isset($_POST['submit'])) { $comment = $_POST['comment']; $comment = SwearFilter($comment); echo $comment; } ?>
  13. Can i ask why people like to solve simple problems with overcomplicated solutions ?? Mine works as good as any others and is shorter and simpler
  14. You could just use str_ireplace(); Saves on all that code e.g. <?php $bad_sentence = "bad bad words here"; $bad_words = array("bad"); echo str_ireplace($bad_words,"*****",$bad_sentence); ?> A better example <?php function SwearFilter($str) { $swearwords = array("arse", "ass", "bitch"); $replacement = "<span class='badwords'>[censored]</span>"; return str_ireplace($swearwords,$replacement,$str); } if (isset($_POST['submit'])) { $comment = $_POST['comment']; $comment = SwearFilter($comment); echo $comment; } ?>
  15. Hey, I am working on a small PHP blackjack and have just converted it to OOP. I have cut out some of the script and kept just the main bits that you need to see. <?php class Blackjack { public $card_suite = array("c","d","h","s"); public $cards = array(0,1,2,3,4,5,6,7,8,9,10,11,12,13); function GenerateCard() { shuffle($this->card_suite); $card = rand(1,10); if($card > 9) $card_face = rand(10,13); else $card_face = $card; return array("suite" => $this->card_suite[rand(0,3)],"value" => $card,"face" => $this->cards[$card_face]); } function new_game() { if(isset($_SESSION['done'])) unset($_SESSION['done']); if(isset($_SESSION['player'])) unset($_SESSION['player']); if(isset($_SESSION['bet'])) unset($_SESSION['bet']); if(isset($_SESSION['computer'])) unset($_SESSION['computer']); if(isset($_SESSION['AI'])) unset($_SESSION['AI']); $_SESSION['player'][] = self::GenerateCard(); $_SESSION['player'][] = self::GenerateCard(); $_SESSION['computer'][] = self::GenerateCard(); $_SESSION['computer'][] = self::GenerateCard(); header("Location:test.php"); } function getTotal($player) { foreach($player as $counting) { $current_total += $counting['value']; } foreach($player as $counting) { if($counting['value'] == 1 && $current_total < 11) $counting['value'] = 11; if($counting['value'] == 11 && $current_total > 11) $counting['value'] = 1; $new_total += $current_value; } return $new_total; } function PrintCards($player,$limit = 0) { $i = 1; if($limit == 0) $limit = 20; foreach($player as $cards) { if($i <= $limit) { $img = $cards['face']."-".$cards['suite']; echo "<img src=\"http://gangster.game-design.djw-designs.com/images/Cards/".$img.".gif\">"; } else echo "<img src=\"http://gangster.game-design.djw-designs.com/images/Cards/cardback.gif\">"; $i++; } } function Hit($player = "") { if(self::getTotal($_SESSION['computer']) < 17) $_SESSION['computer'][] = self::GenerateCard(); $_SESSION['player'][] = self::GenerateCard(); header("Location:test.php"); } function GetEndResult($player1,$player2,$final = false) { if($final) { if($player1 == $player2) { $_SESSION['done'] = true; return "Drew"; } elseif($player1 == 21 || $player2 > 21 || $player1 < 22 && $player1 > $player2) { $_SESSION['done'] = true; $this->bet *= 2; return "Won"; } elseif($player1 > 21 || $player2 == 21 || $player2 < 22 && $player2 > $player1) { $_SESSION['done'] = true; $this->bet = 0; return "Lost"; } } else { if($player1 == 21 || $player2 > 21) return "Won"; elseif($player2 == 21 || $player1 > 21) return "Lost"; else return false; } } function stick($player = "") { if(self::getTotal($_SESSION['computer']) < 17) { $_SESSION['computer'][] = self::GenerateCard(); header("Location:test.php?stick"); } self::PrintCards($_SESSION['computer']); return self::GetEndResult(self::getTotal($_SESSION['player']),self::getTotal($_SESSION['computer']),true); } } class player extends Blackjack { public $bet; public $cash; public $player_name; function GetPlayer() { $this->player_name = "Guest"; return $this->player_name; } function TakeBet($bet) { $this->bet = $bet; $this->cash = 100; if($this->bet <= $this->cash) $this->cash -= $this->bet; } } class computer extends Blackjack { private $players = array("Paul","John","Dean","Tom","Bradly"); public $ai_name; function GeneratePlayer() { shuffle($this->players); $_SESSION['AI'] = $this->players[rand(0,5)]; $this->ai_name = $_SESSION['AI']; return $this->ai_name; } } if(isset($_POST['place_bet'])) $_SESSION['bet'] = $_POST['bet']; if(isset($_SESSION['bet'])) { $blackjack = new Blackjack; if(!isset($_SESSION['player']) || !isset($_SESSION['computer']) || isset($_GET['reset'])) $blackjack -> new_game(); $player = new player; $player -> bet = $_SESSION['bet']; $player -> TakeBet($player -> bet); echo "<br>".$player -> GetPlayer()."<br>"; $blackjack -> PrintCards($_SESSION['player']); echo "<br>Total: ".$blackjack -> getTotal($_SESSION['player']); $computer = new computer; echo "<br>".$computer -> GeneratePlayer()."<br>"; if(isset($_GET['hit']) && !isset($_SESSION['done'])) $blackjack -> hit(); if(isset($_GET['stick'])) echo "<br>You ".$blackjack -> stick(); else { echo "<br>"; if($blackjack -> GetEndResult($blackjack -> getTotal($_SESSION['player']),$blackjack -> getTotal($_SESSION['computer'])) == false) $blackjack -> PrintCards($_SESSION['computer'],1); else { $blackjack -> PrintCards($_SESSION['computer']); echo "<br>You ".$blackjack -> GetEndResult($blackjack -> getTotal($_SESSION['player']),$blackjack -> getTotal($_SESSION['computer'])); } } } ?> Can anyone explain if i am using it correctly, and if not why not and how can i. Thanks, Blade
  16. Sorry to keep confusing people, but same problem , updated code <?php //Blackjack.php ob_start(); session_start(); $card_10 = array(10,11,12,13); $card_type = array("c","d","h","s"); shuffle($card_type); shuffle($card_10); if(!isset($_SESSION['done'])) { //this is where the winnings will be done } if(!isset($_SESSION['player_1']) || !isset($_SESSION['comp_1'])) { $_SESSION['player_1'] = rand(1,10); $_SESSION['card_p_1'] = $card_type[rand(0,3)]; $_SESSION['player_2'] = rand(1,10); $_SESSION['card_p_2'] = $card_type[rand(0,3)]; $_SESSION['comp_1'] = rand(1,10); $_SESSION['card_c_1'] = $card_type[rand(0,3)]; $_SESSION['comp_2'] = rand(1,10); $_SESSION['card_c_2'] = $card_type[rand(0,3)]; $_SESSION['comp_count'] = 2; $_SESSION['player_count'] = 2; } if(isset($_GET['reset'])) { unset($_SESSION['done']); if(isset($_SESSION['player_count'])) { for($i = 1;$i <= $_SESSION['player_count'];$i++) { unset($_SESSION['player_'.$i]); unset($_SESSION['card_p_'.$i]); } unset($_SESSION['player_count']); } for($i = 1;$i <= $_SESSION['comp_count'];$i++) { unset($_SESSION['comp_'.$i]); unset($_SESSION['card_c_'.$i]); } unset($_SESSION['comp_count']); header("Location:test.php"); } echo "<br>Player<br>"; for($i = 1;$i <= $_SESSION['player_count'];$i++) { if($_SESSION['player_'.$i] == 10) { $img = $card_10[rand(0,2)]; } else $img = $_SESSION['player_'.$i]; $type = $_SESSION['card_p_'.$i]; ?> <img src="http://gangster.game-design.djw-designs.com/images/Cards/<?=$img."-".$type?>.gif"> <?php $cards[] = $_SESSION['player_'.$i]; } echo "Total: ".array_sum($cards); echo "<br>Computer<br>"; for($i = 1;$i <= $_SESSION['comp_count'];$i++) { $comp[] = $_SESSION['comp_'.$i]; } if(isset($_GET['hit']) && !isset($_SESSION['done'])) { if(array_sum($comp) < 17) { $_SESSION['comp_count'] += 1; $_SESSION['comp_'.$_SESSION['comp_count']] = rand(1,10); $_SESSION['card_c_'.$_SESSION['comp_count']] = $card_type[rand(0,3)]; } $_SESSION['player_count'] += 1; $_SESSION['player_'.$_SESSION['player_count']] = rand(1,10); $_SESSION['card_p_'.$_SESSION['player_count']] = $card_type[rand(0,3)]; header("Location:test.php"); } if(isset($_GET['stick'])) { if(array_sum($comp) < 17) { $_SESSION['comp_count'] += 1; $_SESSION['comp_'.$_SESSION['comp_count']] = rand(1,10); $_SESSION['card_c_'.$_SESSION['comp_count']] = $card_type[rand(0,3)]; header("Location:test.php?stick"); } for($i = 1;$i <= $_SESSION['comp_count'];$i++) { if($_SESSION['comp_'.$i] == 10) { $img = $card_10[rand(0,2)]; } else $img = $_SESSION['comp_'.$i]; $type = $_SESSION['card_c_'.$i]; ?> <img src="http://gangster.game-design.djw-designs.com/images/Cards/<?=$img."-".$type?>.gif"> <?php } if(array_sum($cards) == array_sum($comp)) echo "<br>Draw"; elseif(array_sum($cards) == 21 || array_sum($comp) > 21 || array_sum($cards) > array_sum($comp) && array_sum($comp) < 22 && array_sum($comp) != 21 && array_sum($cards) != 21 && array_sum($cards) < 22) { echo "You Win"; $_SESSION['done'] = true; } else { echo "You Loose"; $_SESSION['done'] = true; } } else { echo "<br>"; if(array_sum($cards) == 21 || array_sum($comp) > 21 || in_array(1,$cards) && in_array(10,$cards) && array_sum($cards) == 11 && array_sum($cards) < 22) { for($i = 1;$i <= $_SESSION['comp_count'];$i++) { if($_SESSION['comp_'.$i] == 10) { $img = $card_10[rand(0,2)]; } else $img = $_SESSION['comp_'.$i]; $type = $_SESSION['card_c_'.$i]; ?> <img src="http://gangster.game-design.djw-designs.com/images/Cards/<?=$img."-".$type?>.gif"> <?php } echo "You Win"; $_SESSION['done'] = true; } elseif(array_sum($cards) > 21 || array_sum($comp) == 21 || in_array(1,$comp) && in_array(10,$comp) && array_sum($comp) < 22 && array_sum($comp) == 11) { for($i = 1;$i <= $_SESSION['comp_count'];$i++) { if($_SESSION['comp_'.$i] == 10) { $img = $card_10[rand(0,2)]; } else $img = $_SESSION['comp_'.$i]; $type = $_SESSION['card_c_'.$i]; ?> <img src="http://gangster.game-design.djw-designs.com/images/Cards/<?=$img."-".$type?>.gif"> <?php } $_SESSION['done'] = true; echo "You Loose"; } else { for($i = 1;$i <= $_SESSION['comp_count'];$i++) { if($i == 1) { if($_SESSION['comp_'.$i] == 10) { $img = $card_10[rand(0,2)]; } else $img = $_SESSION['comp_'.$i]; $type = $_SESSION['card_c_'.$i]; ?> <img src="http://gangster.game-design.djw-designs.com/images/Cards/<?=$img."-".$type?>.gif"> <?php } else { ?> <img src="http://gangster.game-design.djw-designs.com/images/Cards/cardback.gif"> <?php } } } } ?> <br> <?php if(!isset($_SESSION['done'])) { ?> <a href="?hit">Hit</a> <a href="?stick">Stick</a> <?php } ?> <a href="?reset">Reset</a>
  17. First off, learn how to edit HTML and then look into the mail headers. Google php manual mail function
  18. <?php //Blackjack.php ob_start(); session_start(); $card_10 = array(10,11,12,13); $card_type = array("c","d","h","s"); shuffle($card_type); shuffle($card_10); if(isset($_GET['reset'])) { for($i = 1;$i <= $_SESSION['player_count'];$i++) { unset($_SESSION['player_'.$i]); unset($_SESSION['card_p_'.$i]); } for($i = 1;$i <= $_SESSION['comp_count'];$i++) { unset($_SESSION['comp_'.$i]); unset($_SESSION['card_c_'.$i]); } unset($_SESSION['comp_count']); unset($_SESSION['player_count']); header("Location:test.php"); } if(!isset($_SESSION['player_1']) || !isset($_SESSION['comp_1'])) { $_SESSION['player_1'] = rand(1,10); $_SESSION['card_p_1'] = $card_type[rand(0,3)]; $_SESSION['player_2'] = rand(1,10); $_SESSION['card_p_2'] = $card_type[rand(0,3)]; $_SESSION['comp_1'] = rand(1,10); $_SESSION['card_c_1'] = $card_type[rand(0,3)]; $_SESSION['comp_2'] = rand(1,10); $_SESSION['card_c_2'] = $card_type[rand(0,3)]; $_SESSION['comp_count'] = 2; $_SESSION['player_count'] = 2; } echo "<br>Player<br>"; for($i = 1;$i <= $_SESSION['player_count'];$i++) { if($_SESSION['player_'.$i] == 10) { $img = $card_10[rand(0,2)]; } else $img = $_SESSION['player_'.$i]; $type = $_SESSION['card_p_'.$i]; ?> <img src="http://gangster.game-design.djw-designs.com/images/Cards/<?=$img."-".$type?>.gif"> <?php $cards[] = $_SESSION['player_'.$i]; } echo "Total: ".array_sum($cards); echo "<br>Computer<br>"; for($i = 1;$i <= $_SESSION['comp_count'];$i++) { $comp[] = $_SESSION['comp_'.$i]; } if(isset($_GET['hit'])) { if(array_sum($comp) < 17) { $_SESSION['comp_count'] += 1; $_SESSION['comp_'.$_SESSION['comp_count']] = rand(1,10); $_SESSION['card_c_'.$_SESSION['comp_count']] = $card_type[rand(0,3)]; } $_SESSION['player_count'] += 1; $_SESSION['player_'.$_SESSION['player_count']] = rand(1,10); $_SESSION['card_p_'.$_SESSION['player_count']] = $card_type[rand(0,3)]; header("Location:test.php"); } if(isset($_GET['stick'])) { if(array_sum($comp) < 17) { $_SESSION['comp_count'] += 1; $_SESSION['comp_'.$_SESSION['comp_count']] = rand(1,10); $_SESSION['card_c_'.$_SESSION['comp_count']] = $card_type[rand(0,3)]; header("Location:test.php?stick"); } for($i = 1;$i <= $_SESSION['comp_count'];$i++) { if($_SESSION['comp_'.$i] == 10) { $img = $card_10[rand(0,2)]; } else $img = $_SESSION['comp_'.$i]; $type = $_SESSION['card_c_'.$i]; ?> <img src="http://gangster.game-design.djw-designs.com/images/Cards/<?=$img."-".$type?>.gif"> <?php } if(array_sum($cards) == array_sum($comp)) echo "<br>Draw"; elseif(array_sum($cards) == 21 || array_sum($comp) > 21 || array_sum($cards) > array_sum($comp) && array_sum($comp) < 22 && array_sum($comp) != 21 && array_sum($cards) != 21 && array_sum($cards) < 22) echo "<br>You win"; else echo "<br>You loose"; } else { echo "<br>"; if(array_sum($cards) == 21 || array_sum($comp) > 21 || in_array(1,$cards) && in_array(10,$cards) && array_sum($cards) < 22) { for($i = 1;$i <= $_SESSION['comp_count'];$i++) { if($_SESSION['comp_'.$i] == 10) { $img = $card_10[rand(0,2)]; } else $img = $_SESSION['comp_'.$i]; $type = $_SESSION['card_c_'.$i]; ?> <img src="http://gangster.game-design.djw-designs.com/images/Cards/<?=$img."-".$type?>.gif"> <?php } echo "<br>You Win"; } elseif(array_sum($cards) > 21 || array_sum($comp) == 21 || in_array(1,$comp) && in_array(10,$comp) && array_sum($comp) < 22) { for($i = 1;$i <= $_SESSION['comp_count'];$i++) { if($_SESSION['comp_'.$i] == 10) { $img = $card_10[rand(0,2)]; } else $img = $_SESSION['comp_'.$i]; $type = $_SESSION['card_c_'.$i]; ?> <img src="http://gangster.game-design.djw-designs.com/images/Cards/<?=$img."-".$type?>.gif"> <?php } echo "<br>You Loose"; } else { for($i = 1;$i <= $_SESSION['comp_count'];$i++) { if($i == 1) { if($_SESSION['comp_'.$i] == 10) { $img = $card_10[rand(0,2)]; } else $img = $_SESSION['comp_'.$i]; $type = $_SESSION['card_c_'.$i]; ?> <img src="http://gangster.game-design.djw-designs.com/images/Cards/<?=$img."-".$type?>.gif"> <?php } else { ?> <img src="http://gangster.game-design.djw-designs.com/images/Cards/cardback.gif"> <?php } } } } ?> <br> <a href="?hit">Hit</a> <a href="?reset">Reset</a> <a href="?stick">Stick</a><br> Now saves the card suite, but not what 10 is worth (either 10, king, queen or jack). Any ideas?
  19. Because that would be a waste of time and resources.
  20. yes i know, that is so when you get a new card (hit) it will have a random card type
  21. Hello First off my code <?php //Blackjack.php ob_start(); session_start(); $card_10 = array(11,12,13); $card_type = array("c","d","h","s"); if(isset($_GET['reset'])) { for($i = 1;$i <= $_SESSION['player_count'];$i++) { unset($_SESSION['player_'.$i]); } for($i = 1;$i <= $_SESSION['comp_count'];$i++) { unset($_SESSION['comp_'.$i]); } unset($_SESSION['comp_count']); unset($_SESSION['player_count']); header("Location:test.php"); } if(!isset($_SESSION['player_1']) || !isset($_SESSION['comp_1'])) { $_SESSION['player_1'] = rand(1,10); $_SESSION['player_2'] = rand(1,10); $_SESSION['comp_1'] = rand(1,10); $_SESSION['comp_2'] = rand(1,10); $_SESSION['comp_count'] = 2; $_SESSION['player_count'] = 2; } echo "<br>Player<br>"; for($i = 1;$i <= $_SESSION['player_count'];$i++) { if($_SESSION['player_'.$i] == 10) { shuffle($card_10); $img = $card_10[rand(0,2)]; } else $img = $_SESSION['player_'.$i]; shuffle($card_type); ?> <img src="http://gangster.game-design.djw-designs.com/images/Cards/<?=$img."-".$card_type[rand(0,3)]?>.gif"> <?php $cards[] = $_SESSION['player_'.$i]; } echo "Total: ".array_sum($cards); echo "<br>Computer<br>"; for($i = 1;$i <= $_SESSION['comp_count'];$i++) { $comp[] = $_SESSION['comp_'.$i]; } if(isset($_GET['hit'])) { if(array_sum($comp) < 17) { $_SESSION['comp_count'] += 1; $_SESSION['comp_'.$_SESSION['comp_count']] = rand(1,10); } $_SESSION['player_count'] += 1; $_SESSION['player_'.$_SESSION['player_count']] = rand(1,10); header("Location:test.php"); } if(isset($_GET['stick'])) { if(array_sum($comp) < 17) { $_SESSION['comp_count'] += 1; $_SESSION['comp_'.$_SESSION['comp_count']] = rand(1,10); header("Location:test.php?stick"); } for($i = 1;$i <= $_SESSION['comp_count'];$i++) { if($_SESSION['comp_'.$i] == 10) { shuffle($card_10); $img = $card_10[rand(0,2)]; } else $img = $_SESSION['comp_'.$i]; shuffle($card_type); ?> <img src="http://gangster.game-design.djw-designs.com/images/Cards/<?=$img."-".$card_type[rand(0,3)]?>.gif"> <?php } if(array_sum($cards) == array_sum($comp)) echo "<br>Draw"; elseif(array_sum($cards) == 21 || array_sum($comp) > 21 || array_sum($cards) > array_sum($comp) && array_sum($comp) < 22 && array_sum($comp) != 21 && array_sum($cards) != 21 && array_sum($cards) < 22) echo "<br>You win"; else echo "<br>You loose"; } else { echo "<br>"; if(array_sum($cards) == 21 || array_sum($comp) > 21 || in_array(1,$cards) && in_array(10,$cards) && array_sum($cards) < 22) { for($i = 1;$i <= $_SESSION['comp_count'];$i++) { if($_SESSION['comp_'.$i] == 10) { shuffle($card_10); $img = $card_10[rand(0,2)]; } else $img = $_SESSION['comp_'.$i]; shuffle($card_type); ?> <img src="http://gangster.game-design.djw-designs.com/images/Cards/<?=$img."-".$card_type[rand(0,3)]?>.gif"> <?php } echo "<br>You Win"; } elseif(array_sum($cards) > 21 || array_sum($comp) == 21 || in_array(1,$comp) && in_array(10,$comp) && array_sum($comp) < 22) { for($i = 1;$i <= $_SESSION['comp_count'];$i++) { if($_SESSION['comp_'.$i] == 10) { shuffle($card_10); $img = $card_10[rand(0,2)]; } else $img = $_SESSION['comp_'.$i]; shuffle($card_type); ?> <img src="http://gangster.game-design.djw-designs.com/images/Cards/<?=$img."-".$card_type[rand(0,3)]?>.gif"> <?php } echo "<br>You Loose"; } else { for($i = 1;$i <= $_SESSION['comp_count'];$i++) { if($i == 1) { if($_SESSION['comp_'.$i] == 10) { shuffle($card_10); $img = $card_10[rand(0,2)]; } else $img = $_SESSION['comp_'.$i]; shuffle($card_type); ?> <img src="http://gangster.game-design.djw-designs.com/images/Cards/<?=$img."-".$card_type[rand(0,3)]?>.gif"> <?php } else { ?> <img src="http://gangster.game-design.djw-designs.com/images/Cards/cardback.gif"> <?php } } } } ?> <br> <a href="?hit">Hit</a> <a href="?reset">Reset</a> <a href="?stick">Stick</a><br> Ok, to explain the code will basically play against you when playing 21/blackjack. This all works fine, the problem i am having is that the card type (e.g. Diamonds) constantly changes, when you hit stick or hit, therefore the cards you have could all be hearts then change to diamonds. I don't have any idea how i could avoid this, anyone? Second off when the player or computer's card is a ten we have it show a king, queen or jack. This ,like above , changes constantly so one turn you could have a king then when you hit it could change to a queen. Again any ideas? If you wish to see what i mean here it is http://gangster.game-design.djw-designs.com/test.php Thanks, Blade
×
×
  • 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.