Jump to content

Recommended Posts

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];

?>

Link to comment
https://forums.phpfreaks.com/topic/218619-error-opening-database-please-help/
Share on other sites

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

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.