englishcodemonkey Posted June 21, 2008 Share Posted June 21, 2008 Ok first off I’m using MySQL 4.1 on www.godaddy.com. I am trying to just connect to the database and pull out some information into a floating frame on my website. The error I am getting is “Oops Page not found”. I think the actual connection to MySQL is the problem but I am an absolute PHP beginner and so I could be making a stupid obvious mistake! This is the code I am using, I have blanked out the password for obvious reasons. I have tried several different ways of writing the line starting ‘$dbc’, including putting the variables values straight into the new mysqli. I have also tried using 10.6.171.124 as the host name. <?php $hostname="p41mysql101.secureserver.net"; $username="hosta"; $password="*****"; $dbname="hosta"; $dbc = new mysqli($hostname, $username, $password, $dbname); if (mysql_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); } printf("Host information: %s\n", $dbc->host_info); ?> The above code is from ‘conn.php’ and then in ‘desc.php’ which is what should load information into a frame contains the line: require_once('conn.php'); I have had this working perfect just on ‘localhost’. Thanks for all your help in advanced!! Quote Link to comment Share on other sites More sharing options...
Mattyspatty Posted June 21, 2008 Share Posted June 21, 2008 the "Oops page not found" error means that your page does not exist in the place your looking for it (perhaps a spelling mistake?) check your pages are in the correct place and spelt correctly Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted June 21, 2008 Share Posted June 21, 2008 If your host has MySQL 4.1 (which is bad...active support for MySQL 4.1 ended a year and a half ago), then you probably also have php4, which I'm not sure how much support there is for mysqli in php4. Quote Link to comment Share on other sites More sharing options...
englishcodemonkey Posted June 21, 2008 Author Share Posted June 21, 2008 OK so if I need to update the code to mysql instead of mysqli my 'conn.php' code would be: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <?php $dbhost = 'p41mysql101.secureserver.net'; $dbuser = 'hosta'; $dbpass = '***'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'hosta'; mysql_select_db($dbname); ?> </body> </html> Is this correct?? Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted June 21, 2008 Share Posted June 21, 2008 Did you compare against the manual? http://www.php.net/mysql_connect Quote Link to comment 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.