rookie_sql Posted September 21, 2008 Share Posted September 21, 2008 Hi, I moved a database from one server to another the differnce being the original server is running MySQl 4.1.20 and the new server is running 5.0.27. When I run the script on the new server I get: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/vhosts/xxxx.com/httpdocs/project.php on line 8 If I run the script on the new server and point the DB connection back to the old server it works fine. So I'm guessing there's something different between the two versions that's causing the error. Here's the code I using: <?session_start(void); //connection info include "includes/globalVars.inc.php"; //connect to the database $database = mysql_connect($mysql_hostname,$mysql_username, $mysql_password); mysql_select_db($mysql_database, $database);$query1 = "SELECT PP.*, P.*, PC.* FROM projects P, projectCategory PC left outer join projectPhoto PP on PP.projectId = P.projectId WHERE P.projectId = '$projectId' AND P.projectCategory = PC.categoryId ORDER BY PP.photoOrder ASC"; $result = mysql_db_query ("$mysql_database",$query1); if ($row = mysql_fetch_array ($result)) { $projectId = $row[projectId]; $categoryId = $row[categoryId]; $category = $row[categoryName]; $subCategory = $row[subCategoryName]; $projectName = $row[projectName]; $projectBuilding = $row[projectBuilding]; $projectName = $row[projectName]; $photoSRC = $row[photoSRC]; $projectSummary = $row[projectSummary]; $projectAwards = $row[projectAwards]; } $query1 = "SELECT projectId FROM projects WHERE projectCategory = '$categoryId' ORDER BY projectOrder";$result = mysql_db_query ("$mysql_database",$query1);$count=1; while ($row = mysql_fetch_array ($result)) { $testId = $row[projectId]; if ($next && !$nextId){$nextId = $testId; } if ($testId == $projectId) { $next = true; $hit = true; } if (!$hit){$previousId = $testId;}$count++; } ?> Can anyone tell me what the problem might be? Thanks!! Quote Link to comment https://forums.phpfreaks.com/topic/125179-moving-a-db-from-mysql-4120-to-5027-gives-script-failure/ Share on other sites More sharing options...
fenway Posted September 29, 2008 Share Posted September 29, 2008 Well, I don't know which query is the issue... but check mysql_error() after each one ... and echo each query, too. Quote Link to comment https://forums.phpfreaks.com/topic/125179-moving-a-db-from-mysql-4120-to-5027-gives-script-failure/#findComment-653289 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.