0

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 />";
			}
		}
2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by PaulMoore12
0

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.

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.