Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    May 2011
    Posts
    33
    Member #
    27718
    Hello I need your help, (I am working on MySQL database)

    I created a website with database on the above domain on my reseller account. I successfully upload all the files needed to the right place on the remote server. Funny enough it was working fine on my local server through WAMP, but unfortunately its not working on the remote server.

    This is the error message it gives when i click the page that is connected to the Database (form1.php):

    Warning: mysql_pconnect() [function.mysql-pconnect]: Access denied for user 'namodacr_namodac'@'localhost' (using password: YES) in /home/namodacr/public_html/Connections/namodac2.php on line 9

    Fatal error: Access denied for user 'namodacr_namodac'@'localhost' (using password: YES) in /home/namodacr/public_html/Connections/namodac2.php on line 9

    MY CONNECTION CODES: (saved as namodac2.php inside a folder named Connections)

    <?php
    # FileName="Connection_php_mysql.htm"
    # Type="MYSQL"
    # HTTP="true"
    $hostname_namodac2 = "localhost";
    $database_namodac2 = "namodacr_applications";
    $username_namodac2 = "namodacr_namodac";
    $password_namodac2 = "namodacr_XXXXXXXX";
    $namodac2 = mysql_pconnect($hostname_namodac2, $username_namodac2, $password_namodac2) or trigger_error(mysql_error(),E_USER_ERROR);
    ?>

    The codes on the page (form1.php) :

    <?php require_once('Connections/namodac2.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 dataform (emailaddress, phone) VALUES (%s, %s)",
    GetSQLValueString($_POST['emailone'], "text"),
    GetSQLValueString($_POST['phone'], "text"));

    mysql_select_db($database_namodac2, $namodac2);
    $Result1 = mysql_query($insertSQL, $namodac2) or die(mysql_error());

    $insertGoTo = "form2.php";
    if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
    }
    header(sprintf("Location: %s", $insertGoTo));
    }
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>::Namodac Applicant's Data Collection ::</title>
    <style type="text/css">
    <!--
    #Layer1 {
    position:absolute;
    left:205px;
    top:77px;
    width:597px;
    height:258px;
    z-index:1;
    }
    .style2 {font-family: "Trebuchet MS"; font-size: 12px; }
    #Layer2 {
    position:absolute;
    left:361px;
    top:54px;
    width:324px;
    height:23px;
    z-index:2;
    }
    .style4 {font-size: 14px; font-family: "Trebuchet MS";}
    -->
    </style>

    </head>

    <body>
    <script>
    var fieldalias="Email address field"
    function verify(element1, element2){
    var passed=false
    if (element1.value==''){
    alert("Please fill out the "+fieldalias+"!")
    element1.focus()
    }
    else if (element2.value==''){
    alert("Please verify the "+fieldalias+"!")
    element2.focus()
    }
    else if (element1.value!=element2.value){
    alert("The two "+fieldalias+"s do not match")
    element1.select()
    }
    else
    passed=true

    return passed

    }

    </script>
    <!--Replace "emailone" and "emailtwo" with name of the two associated fields-->
    <div id="Layer1">
    <form action="<?php echo $editFormAction; ?>" id="form1" name="form1" method="POST" onSubmit="return verify(this.emailone, this.emailtwo)">
    <table width="389" border="0" align="center">
    <tr>
    <td width="176">&nbsp;</td>
    <td width="203">&nbsp;</td>
    </tr>
    <tr>
    <td><div align="right" class="style2">Email Address: </div></td>
    <td><label for="textfield"></label>
    <input type="text" name="emailone" id="emailone" /></td>
    </tr>
    <tr>
    <td><div align="right" class="style2">Re-type Email Address: </div></td>
    <td><label for="label"></label>
    <input type="text" name="emailtwo" id="label" /></td>
    </tr>
    <tr>
    <td><div align="right" class="style2">Mobile No: </div></td>
    <td><label for="label2"></label>
    <input type="text" name="phone" id="label2" /></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td><label for="Submit"></label>
    <input type="submit" name="Submit" value="Submit" id="Submit" onClick="return checkmail(this.form.emailone)" /> </td>
    </tr>
    </table>

    <script type="text/javascript">

    /***********************************************
    * Email Validation script- Dynamic Drive (www.dynamicdrive.com)
    * This notice must stay intact for legal use.
    * Visit http://www.dynamicdrive.com/ for full source code
    ***********************************************/

    var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i

    function checkmail(e){
    var returnval=emailfilter.test(e.value)
    if (returnval==false){
    alert("Please enter a valid email address.")
    e.select()
    }
    return returnval
    }

    </script>

    <input type="hidden" name="MM_insert" value="form1">
    </form>
    </div>
    <div class="style4" id="Layer2">
    <h3>Nomadac Applicant's Data Collection </h3>
    </div>
    </body>
    </html>


    So please, tell me what to do, so that i can fix it up and get over this issue.

    Thanks.

  2.  

  3. #2
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    I don't know of any reseller out there that is running their MySQL servers on the same as their web hosting servers... ( i might be wrong )

    That being said...

    Warning: mysql_pconnect() [function.mysql-pconnect]: Access denied for user 'namodacr_namodac'@'localhost' (using password: YES) in

    This looks like a very common error... when you upload code that works locally...

    you need to change your connection string to work with the MySQL servers being called from the host...

    If you go to your reseller account where you setup your MySQL Databases... login to your phpMySql admin console... it will provide you with the proper connection string info to update you files with..

  4. #3
    Member Brillig's Avatar
    Join Date
    Mar 2010
    Posts
    32
    Member #
    21509
    It looks like namodacr_namodac'@'localhost' hasn't been granted access on the other server.

    Have you tried this on the remote server?

    create user 'namodacr_namodac'@'localhost' IDENTIFIED BY '[password]';
    GRANT ALL ON *.* to 'namodacr_namodac'@'localhost';
    Win.ly: A scientific/statistical approach to win prizes online.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:02 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com