Jump to content

Pokemon team help.


Ratee

Recommended Posts

i need help i have this script....   

 

 


<?php 
// Connects to your Database 
include ('db.php');
$sql = "SELECT * FROM pokemon WHERE owner_id=$id and slot=1";
$sql2 = mysql_query($sql);
$rows = mysql_fetch_array($sql2);
$grab = mysql_fetch_array(mysql_query("SELECT * FROM types WHERE id = {$rows['type']}"));
$typename = $grab['name'];
$fetchthis = mysql_fetch_array(mysql_query("SELECT * FROM pokedex WHERE id = {$rows['pokedex_id']}"));
$pokedexname = $fetchthis['name'];
?>





    <?php
if($typename== Normal)
{
echo "";
}
else
{
echo $typename;
}

echo $pokedexname;

?></b>
<?php 
echo "<img src=images/Pokemon/";
echo $typename;
echo "/";
echo $pokedexname;
echo ".png";
echo ">"; ?>


 

 

but if the user has no pokemon i want it to say empty slot, but not to sure how to do it, could anyone help me please?

Link to comment
https://forums.phpfreaks.com/topic/260691-pokemon-team-help/
Share on other sites

does this help at all?


<?php 
// Connects to your Database 
include ('db.php');
//First Query
$Sql = "SELECT * FROM `pokemon` WHERE `owner_id` = '{$id}' and `slot` = '1'";
$Query = mysql_query($Sql);
$Rows = mysql_fetch_array($Query);
//Second Query
$Sql2 = "SELECT * FROM `pokemon` WHERE `owner_id` = '{$id}' and `slot` = '1'";
$Query2 = mysql_query($Sql2);
$Grab = mysql_fetch_array($Query2);
//Third Query
$Sql3 = "SELECT * FROM `pokedex` WHERE `id` = '{$rows['pokedex_id']}'";
$Query3 = mysql_query($Sql3);
$FetchThis = mysql_fetch_array($Query3);
//Num Of Pokemon Per User
$NumOfPokemon = mysql_num_rows($Query2);
//check number
if ($NumOfPokemon == 0) {
echo "No pokemon!";
} else {
if ($Grab['name'] != "Normal") {
	echo "{$Grab['name']}";
}
echo "{$FetchThis['name']}";
echo "<img src=images/Pokemon/";
echo $Grab['name'];
echo "/";
echo $FetchThis['name'];
echo ".png";
echo ">";
}









    <?php
if($typename== Normal)
{
echo "";
}
else
{
echo $typename;
}

echo $pokedexname;

?></b>
<?php 
?>

Link to comment
https://forums.phpfreaks.com/topic/260691-pokemon-team-help/#findComment-1336250
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.