- 
	
	
	
		
MySQL/PHP head scratcher
	
	
		Okay, so I have my website running locally on MySQL and PHP (MySQL version 4.1.12a and PHP version 5.0.4) and everything runs just fine.  I just uploaded some new code to the server, which is running MySQL version 4.0.25-standard and PHP version 4.3.10, and my code dies with the following error message:
mysql_fetch_array(): supplied argument is not a valid MySQL result resource in xxxx.php on line 20
Here's the code that I'm using:
// set up the database connection
    $db = mysql_connect("localhost", "username", "password") or die ('I cannot connect to the database because: ' . mysql_error());;
    mysql_select_db("databasename",$db);
    
    // query the DB for all characterspells
    $sql = "SELECT `Level`, `Name`, `Description` FROM `characterspell`, `spell` WHERE `Character` = 'Celes' and `SpellName` = `Name` ORDER  BY `Level` ";
    $result = mysql_query($sql);	
    
    // print the database results
    while ($myrow = mysql_fetch_array($result))...
    
I've checked the documentation for the methods that I'm using and all have been available since PHP version 3 so I would assum eit's not an issue of different versions of PHP.  Any ideas?
	 
 - 
	
	
	
	
		Never mind, I figured it out.  Looks like my setup doesn't care about case-sensitivity where the server's setup does.  Since my tables are called "CharacterSpell" and "Spell", locally "characterspell" and "spell" work but not on the server, since it's cave sensitive.
	 
 - 
	
	
	
	
		Glad you figured it out.  For future reference, you may want to do something like:
	Code:
	
if (($result = @mysql_query($sql)) === false)
{
   // Error message goes here using mysql_errno() and mysql_error()
}
 So you can catch any errors before trying to fetch rows.  Note: I'm not sure if that exact code will work, just pulled it off the top...I generally use my own custom SQL layer instead.