[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 274
  • Last Modified:

urgent: php forum error

Installation Completed.
Data base references updated
Proceed as Administrator

the problem is when i click to proceed as administator i get the following

errorDatabase error occured: Access denied for user: '@localhost' to database 'gamesemp_cart'
Cannot not select the database gamesemp_cart.
Using query:
Error in /BaalSystems/regadmin.
0
acslater
Asked:
acslater
  • 7
  • 5
1 Solution
 
PromethylCommented:
>Enhanced free discussion form portal software, developed because most of the other portal software applications were !!! too difficult !!! to quickly install and manage.

lol!

Using 3.7 ?

Have you edited common_db.php?

Modify this : (common_db.php )

 $link_id=mysql_connect($dbhost,$dbusername,$dbuserpassword);
if( $link_id == 0 )
    return 0 ;

TO BE THIS:

$link_id=mysql_connect($dbhost,$dbusername,$dbuserpassword);
if( $link_id == 0 ) {
    echo mysql_error();
    return 0 ;
}

0
 
PromethylCommented:
I want to see the error -- on the mysql side.
0
 
acslaterAuthor Commented:
the error is not seen on the mysql side. it shows up when i try to install the forum for the first. That code that u gave me is not in common_db.php. The only code in it is

<?php
ob_start();

$start_time = split(" ", microtime());
$start_time = $start_time[1] + $start_time[0];

ini_set("magic_quotes_gpc", "0");
ini_set("magic_quotes_runtime", "0");

foreach($_GET as $key=>$value) {
    $_GET[$key]=addslashes($value);
}

foreach($_POST as $key=>$value) {
    $_POST[$key]=addslashes($value);
}

foreach($_COOKIE as $key=>$value) {
    $_COOKIE[$key]=addslashes($value);
}

include("incl/db.php");
include("incl/functions.php");
include("incl/prefs.php");
include("incl/int_std.php");

db_connect();

session_start();

?>
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
PromethylCommented:
Have you edited incl/db.php with your database's information?

Below is the other db_connect. ;)

Verify your mysql host, username and password. Mysql is now allowing you access to the database.  Verify permissions.

   function db_connect() {
        global $db;
        if (!mysql_connect($db["host"], $db["user"], $db["pass"]))
            db_report_error("Cannot not connect to the database");
        if (!mysql_select_db($db["dbname"]))
            db_report_error("Cannot not select the database <i>" . $db["dbname"] . "</i>");
    }
   
    function db_report_error($message="", $query="") {
        echo("Database error occured: " . mysql_error() . "<br><b>" . $message . "</b>" . ".<br>Using query: <b>" . $query . "</b><br>Error in " . $_SERVER["PHP_SELF"]);
        exit;
    }

0
 
PromethylCommented:
> errorDatabase error occured: Access denied for user: '@localhost' to database 'gamesemp_cart'

Looking at this error, it looks like the username field is blank.

Make sure to setup that db.php!

I bet the username field is blank!
0
 
acslaterAuthor Commented:
i have edited incl/db.php with my database's information and verified permissions and entered that code for db.php and am still getting the error. Then when i went back into db.php the code u gave me disappears. it looks from the error that the username field is blank but it's not. i hav a presentation to do in college 2moro that is why i need it to work. any ideas

0
 
acslaterAuthor Commented:
all the installation details are entering into the d/b its just getting to the admin stage thats the problem
0
 
PromethylCommented:
Wait a sec... are you calling this program from within another function? If so, in db.php change:
<?
    $db=array(
              "host"=>"localhost",
              "user"=>"root",
              "pass"=>"",
              "dbname"=>""
             );
               
    $tableprefix="_";
?>
 to read:

<? global $db;
    $db=array(
              "host"=>"localhost",
              "user"=>"root",
              "pass"=>"",
              "dbname"=>""
             );
               
    $tableprefix="_";
?>
0
 
acslaterAuthor Commented:
if anyone can help at all i would be very appreciative
0
 
PromethylCommented:
Also, let's get the debug info:

functions.php from:

    function db_connect() {
        global $db;
        if (!mysql_connect($db["host"], $db["user"], $db["pass"]))
            db_report_error("Cannot not connect to the database");
        if (!mysql_select_db($db["dbname"]))
            db_report_error("Cannot not select the database <i>" . $db["dbname"] . "</i>");
    }
   

to:

    function db_connect() {
        global $db;
        echo $db["host"]." <-- host  pass --=> ". $db["user"] ." ". strlen($db[pass]);
        if (!mysql_connect($db["host"], $db["user"], $db["pass"]))
            db_report_error("Cannot not connect to the database");
        if (!mysql_select_db($db["dbname"]))
            db_report_error("Cannot not select the database <i>" . $db["dbname"] . "</i>");
    }
   

Bring this information back to us.
0
 
acslaterAuthor Commented:
nice one Promethyl ur a legend
0
 
PromethylCommented:
Well, thank you, but what was the problem?

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 7
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now