Ratee Posted April 10, 2012 Share Posted April 10, 2012 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 More sharing options...
xyph Posted April 10, 2012 Share Posted April 10, 2012 Check out mysql_num_rows Link to comment https://forums.phpfreaks.com/topic/260691-pokemon-team-help/#findComment-1336137 Share on other sites More sharing options...
chriscloyd Posted April 10, 2012 Share Posted April 10, 2012 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.