NancyBrown Posted November 22, 2013 Share Posted November 22, 2013 I am moving my website written in php 4 to a server that has php5. Here are the 3 warnings I have received. How do I fix this? Warning: mysql select db(): supplied argument is not a valid MySQL-Link resource in /home/xxxxx /index.php on line 37 Line 37 is: mysql_select_db($conn, "yourmil_content"); ----------------------------------------------------------------------------- Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in/home/xxxxxx/index.php on line 247 Line 247 is: $result = mysql_query($sql, $conn); --------------------------------------------------------------------------------------------------- Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in/home/xxxxx/index.php on line 248 Line 248 is: $data = mysql_fetch_array($result); Link to comment https://forums.phpfreaks.com/topic/284172-php4-to-php5-errors/ Share on other sites More sharing options...
JIXO Posted November 22, 2013 Share Posted November 22, 2013 WOW, how did that work in PHP4 !! Line 37 is: mysql_select_db($conn, "yourmil_content"); The first parameter you set is the connection resource, but thats wrong, it should be (see the documentation for mysql_select_db()): Line 37 is: mysql_select_db("yourmil_content", $conn); And this error : Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in/home/xxxxx/index.php on line 248 Line 248 is: $data = mysql_fetch_array($result); is actually a result of this error : Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in/home/xxxxxx/index.php on line 247 Line 247 is: $result = mysql_query($sql, $conn); I would suggest to you to review your connection parameters again. Link to comment https://forums.phpfreaks.com/topic/284172-php4-to-php5-errors/#findComment-1459556 Share on other sites More sharing options...
Ch0cu3r Posted November 22, 2013 Share Posted November 22, 2013 Your database connection is failing. Checking that PHP is connecting to MySQL properly when your call mysql_connect(). Use mysql_error() to see why PHP is failing to connect to mysql. Link to comment https://forums.phpfreaks.com/topic/284172-php4-to-php5-errors/#findComment-1459557 Share on other sites More sharing options...
NancyBrown Posted November 22, 2013 Author Share Posted November 22, 2013 I have no knowledge of PHP other than I know how to change the password to the database and database name in the index.php file. With that said, can you give me easy instructions on how to fix this? Thanks to the 2 replies I have received but I don't know how to do what they are suggesting. Link to comment https://forums.phpfreaks.com/topic/284172-php4-to-php5-errors/#findComment-1459564 Share on other sites More sharing options...
JIXO Posted November 22, 2013 Share Posted November 22, 2013 OK, what OS you're using ? can you post code with the part with mysql_connect() in it ? Link to comment https://forums.phpfreaks.com/topic/284172-php4-to-php5-errors/#findComment-1459573 Share on other sites More sharing options...
NancyBrown Posted November 22, 2013 Author Share Posted November 22, 2013 Here is my definition of $conn // Establish a database connection //$conn = mysql_connect("localhost", "yourmil", "james597"); mysql_select_db("yourmil_content", $conn); Link to comment https://forums.phpfreaks.com/topic/284172-php4-to-php5-errors/#findComment-1459575 Share on other sites More sharing options...
Ch0cu3r Posted November 22, 2013 Share Posted November 22, 2013 Remove the // from in front of mysql_connect The // is a comment, you are causing the connection to be ignored. Link to comment https://forums.phpfreaks.com/topic/284172-php4-to-php5-errors/#findComment-1459577 Share on other sites More sharing options...
NancyBrown Posted November 22, 2013 Author Share Posted November 22, 2013 THANK YOU SO MUCH!!!! IT WORKED!! Link to comment https://forums.phpfreaks.com/topic/284172-php4-to-php5-errors/#findComment-1459579 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.