/    Sign up×
Community /Pin to ProfileBookmark

PHP confusion, connection to DB should work

Hi all, I’m a little frazzled by this problem so hopefully somebody can point me in the right direction.

I’m using Dreamweaver 8 with MySQL 5, and phpMyAdmin.

I’ve been making changes to my website template which is connected to my database and somewhere along the way I’ve encountered a problem with the php script that connects to the DB.

Now in Dreamweaver I’ve tested the connection to the DB and it successfully connected however when I test it on my browser I get the following fatal error:

Fatal error: Access denied for user ‘root’@’localhost’ (using password: NO) in c:inetpubwwwrootwebsiteConnectionsconnect.php on line 9

Now I can think it can be one of two things.

1) the connect.php is incorrect (although I can connect to the DB from connect.php from within dreamweaver).

2) The generated php script is wrong:

[code]<?php require_once(‘../Connections/connect.php’); ?>
<?php
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET[‘pageNum_Recordset1’])) {
$pageNum_Recordset1 = $_GET[‘pageNum_Recordset1’];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_connect, $connect);
$query_Recordset1 = “SELECT * FROM tblnews ORDER BY newsID DESC”;
$query_limit_Recordset1 = sprintf(“%s LIMIT %d, %d”, $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $connect) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET[‘totalRows_Recordset1’])) {
$totalRows_Recordset1 = $_GET[‘totalRows_Recordset1’];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
[/code]

Anyone have any clues?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@chazzyFeb 11.2006 — The error message clearly states:


Fatal error: Access denied for user 'root'@'localhost' (using password: NO) in c:inetpubwwwrootwebsiteConnections[b]connect.php on line 9[/b][/quote]
Means there's a problem in connect.php
Copy linkTweet thisAlerts:
@SwashbucklerauthorFeb 11.2006 — Thanks...found out that whilst my connect.php on my c: drive was correct it hadn't updated it on the localmachine.
×

Success!

Help @Swashbuckler spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...