Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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