Jump to content

2 Warnings


HolySymbol

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/275784-2-warnings/
Share on other sites

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 :/

Link to comment
https://forums.phpfreaks.com/topic/275784-2-warnings/#findComment-1420263
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.