acslater
asked on
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.
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.
I want to see the error -- on the mysql side.
ASKER
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_runt ime", "0");
foreach($_GET as $key=>$value) {
$_GET[$key]=addslashes($va lue);
}
foreach($_POST as $key=>$value) {
$_POST[$key]=addslashes($v alue);
}
foreach($_COOKIE as $key=>$value) {
$_COOKIE[$key]=addslashes( $value);
}
include("incl/db.php");
include("incl/functions.ph p");
include("incl/prefs.php");
include("incl/int_std.php" );
db_connect();
session_start();
?>
<?php
ob_start();
$start_time = split(" ", microtime());
$start_time = $start_time[1] + $start_time[0];
ini_set("magic_quotes_gpc"
ini_set("magic_quotes_runt
foreach($_GET as $key=>$value) {
$_GET[$key]=addslashes($va
}
foreach($_POST as $key=>$value) {
$_POST[$key]=addslashes($v
}
foreach($_COOKIE as $key=>$value) {
$_COOKIE[$key]=addslashes(
}
include("incl/db.php");
include("incl/functions.ph
include("incl/prefs.php");
include("incl/int_std.php"
db_connect();
session_start();
?>
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["dbn ame"]))
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;
}
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_report_error("Cannot not connect to the database");
if (!mysql_select_db($db["dbn
db_report_error("Cannot not select the database <i>" . $db["dbname"] . "</i>");
}
function db_report_error($message="
echo("Database error occured: " . mysql_error() . "<br><b>" . $message . "</b>" . ".<br>Using query: <b>" . $query . "</b><br>Error in " . $_SERVER["PHP_SELF"]);
exit;
}
> 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!
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!
ASKER
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
ASKER
all the installation details are entering into the d/b its just getting to the admin stage thats the problem
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="_";
?>
<?
$db=array(
"host"=>"localhost",
"user"=>"root",
"pass"=>"",
"dbname"=>""
);
$tableprefix="_";
?>
to read:
<? global $db;
$db=array(
"host"=>"localhost",
"user"=>"root",
"pass"=>"",
"dbname"=>""
);
$tableprefix="_";
?>
ASKER
if anyone can help at all i would be very appreciative
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
nice one Promethyl ur a legend
Well, thank you, but what was the problem?
lol!
Using 3.7 ?
Have you edited common_db.php?
Modify this : (common_db.php )
$link_id=mysql_connect($db
if( $link_id == 0 )
return 0 ;
TO BE THIS:
$link_id=mysql_connect($db
if( $link_id == 0 ) {
echo mysql_error();
return 0 ;
}