HolySymbol Posted March 17, 2013 Share Posted March 17, 2013 Hi, when I try to access my php file I get 2 warnings: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /disk3/daniel/public_html/client/test.php on line 8 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /disk3/daniel/public_html/client/test.php on line 36 My test.php file: <?php include "mysql.php"; $playername = $_GET["player"]; $query = mysql_query("SELECT * FROM skills WHERE playerName = '".$playername."'"); $query2 = mysql_query("SELECT * FROM skillsoverall WHERE playerName = '".$playername."'"); while($row = mysql_fetch_array($query)){ echo($row['playerName']); echo(" " . $row['Attacklvl']); echo(" " . $row['Strengthlvl']); echo(" " . $row['Defencelvl']); echo(" " . $row['Rangelvl']); echo(" " . $row['Prayerlvl']); echo(" " . $row['Magiclvl']); echo(" " . $row['Runecraftlvl']); echo(" " . $row['Constructionlvl']); echo(" " . $row['Dungeoneeringlvl']); echo(" " . $row['Hitpointslvl']); echo(" " . $row['Agilitylvl']); echo(" " . $row['Herblorelvl']); echo(" " . $row['Thievinglvl']); echo(" " . $row['Craftinglvl']); echo(" " . $row['Fletchinglvl']); echo(" " . $row['Slayerlvl']); echo(" " . $row['Hunterlvl']); echo(" " . $row['Mininglvl']); echo(" " . $row['Smithinglvl']); echo(" " . $row['Fishinglvl']); echo(" " . $row['Cookinglvl']); echo(" " . $row['Firemakinglvl']); echo(" " . $row['Woodcuttinglvl']); echo(" " . $row['Farminglvl']); echo(" " . $row['Summoninglvl']); } while($row = mysql_fetch_array($query2)){ echo(" " . $row['kills']); echo(" " . $row['deaths']); } ?> How can I fix this? Quote Link to comment Share on other sites More sharing options...
Jessica Posted March 17, 2013 Share Posted March 17, 2013 A. Do one query, joining the tables B. see my signature on handling mysql errors Quote Link to comment Share on other sites More sharing options...
HolySymbol Posted March 18, 2013 Author Share Posted March 18, 2013 A. Do one query, joining the tables B. see my signature on handling mysql errors Thank you but I am new at php coding. How can I make one query to join the tables? Quote Link to comment Share on other sites More sharing options...
Jessica Posted March 18, 2013 Share Posted March 18, 2013 Google "MySQL JOIN". Looking at your code further you may not need to join them. Why would you store "kills" and "deaths" in a table called skillsoverall? Is that supposed to be KILLS not SKILLS? Quote Link to comment Share on other sites More sharing options...
HolySymbol Posted March 22, 2013 Author Share Posted March 22, 2013 Google "MySQL JOIN". Looking at your code further you may not need to join them. Why would you store "kills" and "deaths" in a table called skillsoverall? Is that supposed to be KILLS not SKILLS? I was going to add skillsoverall so I forgot to change kills and deaths lol... But thank you Sorry for late relpy :/ Quote Link to comment 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.