Jump to content

Recommended Posts

as soon as i upgraded from PHP4 to PHP5 and i started getting the bellow error, its not connecting to the database no more, files and setting are the same.....this is a compatibility issue, how can i get a fix around this ??? i cant post the script here, its too big.....any help ??? ......thanks

 

Warning: mysql() [function.mysql]: Access denied for user 'apache'@'localhost' (using password: NO)

Link to comment
https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/
Share on other sites

it has nothing to do with it............it works when i downgrade to php4.....its not the setting in the conf file, its the same info........

<xml>

 

</section>

<section name="DATABASE CONFIGURATION">

<field type="select" name="db_type" text="Select your database type" help="http://www.ThisWasRemovedByMe.com/products/ThisWasRemovedByMe/documentation/system_configuration.html#select_your_database_type">MySQL<enum val="MySQL">1</enum>

</field>

<field required="1" type="edit" name="db_host" text="Your database host" help="http://www.ThisWasRemovedByMe.com/products/ThisWasRemovedByMe/documentation/system_configuration.html#your_database_host">localhost</field>

<field required="1" type="edit" name="db_login" text="Your database username" help="http://www.ThisWasRemovedByMe.com/products/ThisWasRemovedByMe/documentation/system_configuration.html#your_database_username">REMOVED</field>

<field type="edit" name="db_pswd" text="Your database password" help="http://www.ThisWasRemovedByMe.com/products/ThisWasRemovedByMe/documentation/system_configuration.html#your_database_password">REMOVED</field>

<field required="1" type="edit" name="db_name" text="Database name" help="http://www.ThisWasRemovedByMe.com/products/ThisWasRemovedByMe/documentation/system_configuration.html#database_name">REMOVED</field>

</section>

 

</xml>

 

Link to comment
https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-274458
Share on other sites

Your script clearly isn't connecting to the database. The problem is more than likely one of the following.

 

1) Your MySQL settings are incorrect

2) Your PHP configuration is a little messy after the upgrade, you might even have register_globals on before and off after, who knows.

3) Your script is most likely using a very outdated set of mysql functions.

Link to comment
https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-274737
Share on other sites

I would do with #3.........

 

 

setting are everything eles is the same, this happenes when i click and upgrade to PHP 5....i get that error on line 19

 

 

<?

  $connected = false;

  function c()

  {

      global $db_host, $db_login, $db_pswd;

 

      $db = @mysql_connect($db_host, $db_login, $db_pswd);

      $connected = true;

      return $db;

  }

 

function q($q_str)

{

    global $db_name, $connected;

    if(!$connected)

    {

    c();

    }

 

    $r = mysql($db_name, $q_str);

    return $r;

}

 

function d($db)

{

    @mysql_close($db);

}

 

function e($r)

{

  if(@mysql_numrows($r))

  return 0;

  else return 1;

}

 

function f($r){

  return @mysql_fetch_array($r);

}

 

function nr($r){

  return @mysql_num_rows($r);

}

?>

 

Link to comment
https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-274773
Share on other sites

Try changing:

 

 function q($q_str)
{
    global $db_name, $connected;
    if(!$connected)
    {
       c();
    }

    $r = mysql($db_name, $q_str);
    return $r;
}

 

to

 

 function q($q_str) {
    global $connected;
    if(!$connected) {
       c();
    }

    $r = mysql_query($q_str);
    return $r;
}

 

 

and

 

  $connected = false;
  function c()
  {
      global $db_host, $db_login, $db_pswd;

      $db = @mysql_connect($db_host, $db_login, $db_pswd);
      $connected = true;
      return $db;
  }

 

to

 

$connected = false;
  function c() {
      global $db_host, $db_login, $db_name, $db_pswd;

      $db = @mysql_connect($db_host, $db_login, $db_pswd);
      @mysql_select_db($db_name) or die('MySQL Error: Could not locate the specified database');
     $connected = true;
      return $db;
  }

Link to comment
https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-274890
Share on other sites

Try changing the last one to:

 

$connected = false;
  function c() {
      global $db_host, $db_login, $db_name, $db_pswd;

      $dbconn = @mysql_connect($db_host, $db_login, $db_pswd);
      @mysql_select_db($db_name, $dbconn) or die('MySQL Error: Could not locate the specified database');
     $connected = true;
      return $dbconn;
  }

 

Also make sure your $db_name variable is set to the name of the mysql database.

Link to comment
https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-275083
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.