morbidangel2012 Posted November 14, 2010 Share Posted November 14, 2010 Hi my friend and I are making a text based thug game and we are in a root. We have all the coding done and our database set up only problem we are having is when you go to our page and try to register is always says "Error opening database" It's so frustrating because I don't know what else I have to setup to to connect to my database. If someone could take a look at our site mintcitymarine.com or if someone is interested in setting up our config.inc.php I would be willing to pay please get ahold of me I know it's something simple and our game has great potential to be a money maker. Thanks, Dale. P.S Here is a copy of my Inc.settings.php which is required for every page. <? //set defaults: //site home dir ie: 174.121.33.189/mintcitymarine $sitedir = "www.mintcitymarine.com"; //session home dir $homedir = "www.mintcitymarine.com/"; // database settings $dbhost = "Localhost"; $dbuser = "mintcity@localhost"; $dbpass = "*****; $dbname = "mintcity_thugz"; $sqlcz = "SELECT lasttime from og_updatefl"; @mysql_connect( $dbhost, $dbuser, $dbpass); @mysql_select_db($dbname) or die("Error opening database"); $resultcz = @mysql_query($sqlcz); $myrowcz = @mysql_fetch_array($resultcz); echo $myrowcz[lasttime]; ?> Quote Link to comment https://forums.phpfreaks.com/topic/218619-error-opening-database-please-help/ Share on other sites More sharing options...
mikosiko Posted November 15, 2010 Share Posted November 15, 2010 You can do a couple things: 1) add the 2 lines in my signature at the beginning of your code... that could help you to detect you errors. 2) remove all those "@'s" from your code... and never use them... they only hide your code errors... not good. 3) at least add die("error : " . mysql_error());" after your connect and fetch sentence to detect/control errors. your error is most likely because you are not connecting to your DB and you are not seeing the error because the @'s try/test and let us know Quote Link to comment https://forums.phpfreaks.com/topic/218619-error-opening-database-please-help/#findComment-1134207 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.