Xyphon Posted December 25, 2007 Share Posted December 25, 2007 Do you know why this: <?PHP //Include Files include('Connect.php'); include('top.php'); //Define Variables $GetID= $_GET['id']; $ID= $_COOKIE['UserID']; $UserName = $_COOKIE['UserName']; $usercheck = addslashes($_POST['username']); $result2 = mysql_query("SELECT * FROM users"); $rows2 = mysql_fetch_array($result2); $result = mysql_query("SELECT * FROM pokemon_info WHERE user_id='$GetID' AND username='$usercheck'"); $rows= mysql_fetch_array($result); //Encrypt Data $GetID= mysql_real_escape_string($GetID); //If User Is Not Logged In if(!isset($ID)) { echo "Sorry, you must be logged in to view this page."; include('bottom.php'); exit; } //If User Does Not Exist if(empty($rows)) { //Display Message echo "Sorry, the specified user does not exist."; //Include Bottom File include("bottom.php"); //Exit Page exit; } //Find Slot $result7= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$GetID' AND pokemon_slot='7'"); $rows7= mysql_fetch_array($result7); //Define Pokémon Variables $vp_pokemon_name7= $rows7['pokemon_name']; $vp_pokemon_image7= $rows7['pokemon_image']; $vp_pokemon_attack7= $rows7['pokemon_attack']; $vp_pokemon_defence7= $rows7['pokemon_defence']; $vp_pokemon_level7= $rows7['pokemon_level']; $vp_pokemon_exp7= $rows7['pokemon_exp']; $vp_pokemon_nexp7= $rows7['pokemon_nexp']; $vp_pokemon_gender7= $rows7['pokemon_gender']; $vp_attack17= $rows7['attack1']; $vp_attack27= $rows7['attack2']; $vp_attack37= $rows7['attack3']; $vp_attack47= $rows7['attack4']; while($rows = mysql_fetch_array($result)); { //Display Information echo "The box of user ID " . $rows['user_id'] . ":<br />"; echo "<table border='1' bgcolor='lightgrey'>"; echo "<br /><br />"; echo "<tr>"; echo "<td><center>" . $vp_pokemon_name7 . "<br /><img border='0' src='" . $vp_pokemon_image7 . "'></center></td></tr>"; echo "<tr><td>Attack: " . $vp_pokemon_attack7 . "</td></tr>"; echo "<tr><td>Defense: " . $vp_pokemon_defence7 . "</td></tr>"; echo "<tr><td>Level: " . $vp_pokemon_level7 . "</td></tr>"; echo "<tr><td>EXP: $vp_pokemon_exp7/" . $vp_pokemon_nexp7 . "</td></tr>"; echo "<tr><td>Gender: <br />" . $vp_pokemon_gender7 . "<br /></td></tr>"; echo "<tr><td><b>Moves:</b> <br /> " . $vp_attack17 . "<br />" . $vp_attack27 . "<br />" . $vp_attack37 . "<br />" . $vp_attack47 . "<br /></td></tr></table>"; } include('bottom.php'); ?> <br />Only displays the last box pokemon? Quote Link to comment https://forums.phpfreaks.com/topic/83175-only-displays-last-box-pokemon/ Share on other sites More sharing options...
teng84 Posted December 25, 2007 Share Posted December 25, 2007 $rows= mysql_fetch_array($result); while($rows = mysql_fetch_array($result)); those line fetches array.. so the first result will be given to first fetch and the second will be for your while loop meaning you will only get the second result up to the last result in your while loop i have answered this in JS forum hmm... Quote Link to comment https://forums.phpfreaks.com/topic/83175-only-displays-last-box-pokemon/#findComment-423075 Share on other sites More sharing options...
Xyphon Posted December 25, 2007 Author Share Posted December 25, 2007 Can you fix it? Quote Link to comment https://forums.phpfreaks.com/topic/83175-only-displays-last-box-pokemon/#findComment-423079 Share on other sites More sharing options...
teng84 Posted December 25, 2007 Share Posted December 25, 2007 will you pay me. lol ok i'll try Quote Link to comment https://forums.phpfreaks.com/topic/83175-only-displays-last-box-pokemon/#findComment-423081 Share on other sites More sharing options...
teng84 Posted December 25, 2007 Share Posted December 25, 2007 $result = mysql_query("SELECT * FROM pokemon_info WHERE user_id='$GetID' AND username='$usercheck'"); $rows= mysql_fetch_array($result); $result7= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$GetID' AND pokemon_slot='7'"); $rows7= mysql_fetch_array($result7); how many rows do you expect for those lines? Quote Link to comment https://forums.phpfreaks.com/topic/83175-only-displays-last-box-pokemon/#findComment-423087 Share on other sites More sharing options...
Xyphon Posted December 25, 2007 Author Share Posted December 25, 2007 There will be unlimited users and pokemon.. So unlimited. Quote Link to comment https://forums.phpfreaks.com/topic/83175-only-displays-last-box-pokemon/#findComment-423093 Share on other sites More sharing options...
Xyphon Posted December 26, 2007 Author Share Posted December 26, 2007 Hello? Quote Link to comment https://forums.phpfreaks.com/topic/83175-only-displays-last-box-pokemon/#findComment-423101 Share on other sites More sharing options...
revraz Posted December 26, 2007 Share Posted December 26, 2007 People help others here to be nice. Maybe you should hire someone to do your code if you're that impatient? Quote Link to comment https://forums.phpfreaks.com/topic/83175-only-displays-last-box-pokemon/#findComment-423104 Share on other sites More sharing options...
Northern Flame Posted December 26, 2007 Share Posted December 26, 2007 There will be unlimited users and pokemon.. So unlimited. unlimited is not a number, try to be realistic Quote Link to comment https://forums.phpfreaks.com/topic/83175-only-displays-last-box-pokemon/#findComment-423106 Share on other sites More sharing options...
teng84 Posted December 26, 2007 Share Posted December 26, 2007 $result = mysql_query("SELECT * FROM pokemon_info WHERE user_id='$GetID' AND username='$usercheck'"); $rows= mysql_fetch_array($result); $result7= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$GetID' AND pokemon_slot='7'"); $rows7= mysql_fetch_array($result7); how many rows do you expect for those lines? maybe you need to perform join in that two tables. and try to put a comment on each query so we know what each query does .. Quote Link to comment https://forums.phpfreaks.com/topic/83175-only-displays-last-box-pokemon/#findComment-423115 Share on other sites More sharing options...
Xyphon Posted December 26, 2007 Author Share Posted December 26, 2007 There will be unlimited users and pokemon.. So unlimited. unlimited is not a number, try to be realistic 999999999999999999999999999999999999999999999999999999999 then. Pokemon add up like crazy already. And The result 7 is to mysql_fetch_array the box pokemon or the '7th' slot. The other one is to set their userid as the cookie makes it and same as the username. Quote Link to comment https://forums.phpfreaks.com/topic/83175-only-displays-last-box-pokemon/#findComment-423128 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.