Jump to content
The Uniform Server Community

mysql - password error


reidesign
 Share

Recommended Posts

I'm receiving this error:

 

PHP Fatal error: Access denied for user 'root'@'localhost' (using password: NO) in /home/.sites/85/site23/web/Connections/MineWorks.php on line 9

 

Here's the code:

 

<?php require_once('Connections/MineWorks.php'); ?>

 

<?php

 

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

 

{

 

$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

 

 

 

switch ($theType) {

 

case "text":

 

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

 

break;

 

case "long":

 

case "int":

 

$theValue = ($theValue != "") ? intval($theValue) : "NULL";

 

break;

 

case "double":

 

$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";

 

break;

 

case "date":

 

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

 

break;

 

case "defined":

 

$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

 

break;

 

}

 

return $theValue;

 

}

 

 

 

$editFormAction = $_SERVER['PHP_SELF'];

 

if (isset($_SERVER['QUERY_STRING'])) {

 

$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

 

}

 

 

 

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {

 

$insertSQL = sprintf("INSERT INTO test (`first`) VALUES (%s)",

 

GetSQLValueString($_POST['first'], "text"));

 

 

 

mysql_select_db($database_MineWorks, $MineWorks);

 

$Result1 = mysql_query($insertSQL, $MineWorks) or die(mysql_error());

 

 

 

$insertGoTo = "success.php";

 

if (isset($_SERVER['QUERY_STRING'])) {

 

$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";

 

$insertGoTo .= $_SERVER['QUERY_STRING'];

 

}

 

header(sprintf("Location: %s", $insertGoTo));

 

}

 

?>

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

 

<html>

 

<head>

 

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

 

<title>Untitled Document</title>

 

</head>

 

 

 

<body>

 

<form name="form1" method="POST" action="<?php echo $editFormAction; ?>">

 

<table width="100%" border="0" cellspacing="0" cellpadding="5">

 

<tr>

 

<td>first</td>

 

<td><input name="first" type="text" id="first" value="first" maxlength="25"></td>

 

</tr>

 

<tr>

 

<td> </td>

 

<td> </td>

 

</tr>

 

<tr>

 

<td> </td>

 

<td> </td>

 

</tr>

 

<tr>

 

<td> </td>

 

<td> </td>

 

</tr>

 

<tr>

 

<td> </td>

 

<td> </td>

 

</tr>

 

<tr>

 

<td><input type="submit" name="Submit" value="Submit"></td>

 

<td> </td>

 

</tr>

 

</table>

 

<input type="hidden" name="MM_insert" value="form1">

 

</form>

 

</body>

 

</html>

 

Here's my Connection file:

 

<?php

# FileName="Connection_php_mysql.htm"

# Type="MYSQL"

# HTTP="true"

$hostname_MineWorks = "localhost";

$database_MineWorks = "mineworks";

$username_MineWorks = "root";

$password_MineWorks = "";

$MineWorks = mysql_pconnect($hostname_MineWorks, $username_MineWorks, $password_MineWorks) or trigger_error(mysql_error(),E_USER_ERROR);

?>

 

When I set my connection in Dreamweaver MX I'm using localhost for mysql server, root for user and pw is left blank.

 

When I use the page locally and check the table, the information is stored. When I try to use the page remotely, I don't see anything but a blank white page. My hosting company told me what the error message is they received.

 

Any suggestions?

Thanks,

Reid

Link to comment
Share on other sites

Maybe your hosting company is using a different mySQL password?

 

As I'm very new to php mysql etc., please be patient.

 

I'm using Dreamweaver and when I create the page, I use the settings for my testing server (on my machine). Should I then change the settings to the user id and pw as per the hosting information?

 

Thanks.

Link to comment
Share on other sites

A. Moved the topic.

 

From what i understand, you are not getting that error on Uniform Server but from your hosted server online.

 

If thats the case, then contact your hosting company for your mysql username and password. Make sure you import the database also if you have too.

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
 Share

×
×
  • Create New...