I create my code on my own machine and tested it on my own machine and everything worked perfectly fine but as soon as I uploaded it to my server it seems to have stopped working. None of the code has been changed except for the database user, pass and name.

This is the error I am encountering;

mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/pmoore/domains/moorepaul.com/public_html/suggest/includes/database.php on line 66

That section of code is as follows;

public function fetch_array($result) {
			$table_result=array();
			$r=0;
			while($row = mysql_fetch_assoc($result)){
				$arr_row=array();
				$c=0;
				while ($c < mysql_num_fields($result)) {        
					$col = mysql_fetch_field($result, $c);    
					$arr_row[$col -> name] = $row[$col -> name];            
					$c++;
				}    
				$table_result[$r] = $arr_row;
				$r++;
			}    
			return $table_result;
		}

and the section of code calling the function;

foreach ($games as $game) {
			$gamefix = str_replace(' ', '+', $game);
			$sql = "SELECT `Achievement` FROM `" . $gamefix . "`";
			$result_set = $database->query($sql);
			$achievements = $database->fetch_array($result_set);
			echo "<h4>{$game}</h4>";
			foreach ($achievements as $achievement) {
				echo $achievement['Achievement'] . "<br />";
			}
		}

What does the "Achievement" table in your database look like? Not the content, just the structure. Also, it seems to me like you may have more going on there than is really needed.

What does the "Achievement" table in your database look like? Not the content, just the structure. Also, it seems to me like you may have more going on there than is really needed.

Thanks for your quick reply I found out what the problem was. The server runs on Linux and I was trying to query the database database.Ace+of+Skies when the it was database.ace+of+skies It worked find on my windows computer as it doesn't have to be case sensitive.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.