From: "Isaak Malik" on
If you get an error of this kind:

"Warning: mysql_query() [function.mysql-query]: Access denied for user
'ODBC'@'localhost' (using password: NO) in D:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\login.php on line 17

Warning: mysql_query() [function.mysql-query]: A link to the server could
not be established in
D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on
line 17"

It means that either your mysql conenction details are not correctly set or
the connection resource isn't accessible for your mysql functions. I suggest
you first try by replacing:

$link = mysql_pconnect('localhost', 'root', 'testing');

into:

mysql_pconnect('localhost', 'root', 'testing');

On 6/17/08, bateivan <ivanovivans(a)yahoo.ca> wrote:
>
>
> Hello,
>
> First of all, please, have in mind that I am new in this business.
>
> I have a problem connecting with data base in one particular module. That's
> right. The rest of the modules can connect to db, update tables with new
> info but this one is refusing giving me message like this:
>
> "Warning: mysql_query() [function.mysql-query]: Access denied for user
> 'ODBC'@'localhost' (using password: NO) in D:\Program Files\Apache
> Software
> Foundation\Apache2.2\htdocs\login.php on line 17
>
> Warning: mysql_query() [function.mysql-query]: A link to the server could
> not be established in
> D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on
> line 17"
>
>
> It is a authentication module and this is the fragment of the code which is
> giving me a hard time:
>
>
> *******************************************************************************
> <?php
> include $_SERVER['DOCUMENT_ROOT'].
> '/layout.php';
>
> switch($_REQUEST['req']){
>
> case "validate":
>
> $validate = mysql_query("SELECT * FROM members
> WHERE username = '{$_POST['username']}'
> AND password = md5('{$_POST['password']}')"
> );
>
> etc....
>
>
> *******************************************************************************
>
> My platform is WinXP on drive F:\ (I have Win'98 on C:\) and as you can see
> my program files are on D:\. All this may not be important but I listed
> anyway.
> It is installed Apache 2.2.6 using windows installer, PHP 5.2.6 (I just
> replaced 5.2.5 hoping to fix the problem), and MySQL 5.0.45.
>
> I am using persisten connection which should be on until you restart the
> server. I have a file included in every page for connection with MySQL and
> data base.
> PHP manual says that "mysql_query" reuses the existing connection or try to
> create one if not present (I think, according to the warning is trying to
> create one).
> I had been checking after each step using phpinfo() if the connection is
> there and it's there but for some reason the above fragment does not work.
> As I mentioned above the rest of my modules are working fine with mysql.
>
> I checked the "php.ini" file. I compared it to "php.ini.recomended" from
> the
> .zip distribusion package and they are almost identical exept couple of
> things for error reporting.
> I, also checked FAQ, mail listings and other forums but it does not seem
> anybody had a similar problem.
>
> In one of my tests I included a line for connection just before the problem
> lines, as described below, and it worked but my intention is to keep such
> lines in a separate files and include them in every page instead.
>
>
> *******************************************************************************
> .......
>
> $link = mysql_pconnect('localhost', 'root', 'testing');
>
>
> $validate = mysql_query("SELECT * FROM members
> WHERE username = '{$_POST['username']}'
> AND password = md5('{$_POST['password']}')"
> );
> etc.
>
> *******************************************************************************
>
> As I metioned, this is an authentication module and, may be, that's why is
> behaving diferently from the rest or I need to do some setup changes in
> "php.ini" which I am not familiar with.
>
> If anyone has had simmilar problem I would appreciate his/her input.
> Please,
> help me resolve this mistery.
>
> --
> View this message in context:
> http://www.nabble.com/PHP-MySQL-connection-for-particular-module-tp17915108p17915108.html
> Sent from the Php - Database mailing list archive at Nabble.com.
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Isaak Malik
Web Developer
From: "Eric" on

----------------------------------------------------
http://myprojects.srhost.info
eric{at}myprojects{dot}srhost{dot}info
----- Original Message -----
From: "bateivan" <ivanovivans(a)yahoo.ca>
To: <php-db(a)lists.php.net>
Sent: Tuesday, June 17, 2008 11:19 PM
Subject: [PHP-DB] PHP-MySQL connection for particular module


:
: Hello,
:
: First of all, please, have in mind that I am new in this business.
:
: I have a problem connecting with data base in one particular module. That's
: right. The rest of the modules can connect to db, update tables with new
: info but this one is refusing giving me message like this:
:
: "Warning: mysql_query() [function.mysql-query]: Access denied for user
: 'ODBC'@'localhost' (using password: NO) in D:\Program Files\Apache Software
: Foundation\Apache2.2\htdocs\login.php on line 17
:

This error message state that you have provided a wrong username and / or password
use the die also to ensure the connection was created.

: Warning: mysql_query() [function.mysql-query]: A link to the server could
: not be established in
: D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on
: line 17"
:
:
: It is a authentication module and this is the fragment of the code which is
: giving me a hard time:
:
: *******************************************************************************
: <?php
: include $_SERVER['DOCUMENT_ROOT'].
: '/layout.php';
:

Let's your included page on the same directory. Say f:\webroot\docroot
As
f:\webroot\docroot\layout.php
f:\webroot\docroot\login.php

then try change the line from

include $_SERVER['DOCUMENT_ROOT'].
'/layout.php';

to

$app_root = './';
include ($app_root . 'layout.php');


: switch($_REQUEST['req']){
:
: case "validate":
:
: $validate = mysql_query("SELECT * FROM members
: WHERE username = '{$_POST['username']}'
: AND password = md5('{$_POST['password']}')"
: );
:
: etc....
:
: *******************************************************************************
:
: My platform is WinXP on drive F:\ (I have Win'98 on C:\) and as you can see
: my program files are on D:\. All this may not be important but I listed
: anyway.
: It is installed Apache 2.2.6 using windows installer, PHP 5.2.6 (I just
: replaced 5.2.5 hoping to fix the problem), and MySQL 5.0.45.
:
: I am using persisten connection which should be on until you restart the
: server. I have a file included in every page for connection with MySQL and
: data base.
: PHP manual says that "mysql_query" reuses the existing connection or try to
: create one if not present (I think, according to the warning is trying to
: create one).
: I had been checking after each step using phpinfo() if the connection is
: there and it's there but for some reason the above fragment does not work.
: As I mentioned above the rest of my modules are working fine with mysql.
:
: I checked the "php.ini" file. I compared it to "php.ini.recomended" from the
: .zip distribusion package and they are almost identical exept couple of
: things for error reporting.
: I, also checked FAQ, mail listings and other forums but it does not seem
: anybody had a similar problem.
:
: In one of my tests I included a line for connection just before the problem
: lines, as described below, and it worked but my intention is to keep such
: lines in a separate files and include them in every page instead.
:
: *******************************************************************************
: .......
:
: $link = mysql_pconnect('localhost', 'root', 'testing');
:
:
: $validate = mysql_query("SELECT * FROM members
: WHERE username = '{$_POST['username']}'
: AND password = md5('{$_POST['password']}')"
: );
: etc.
: *******************************************************************************
:
: As I metioned, this is an authentication module and, may be, that's why is
: behaving diferently from the rest or I need to do some setup changes in
: "php.ini" which I am not familiar with.
:
: If anyone has had simmilar problem I would appreciate his/her input. Please,
: help me resolve this mistery.
:
: --
: View this message in context: http://www.nabble.com/PHP-MySQL-connection-for-particular-module-tp17915108p17915108.html
: Sent from the Php - Database mailing list archive at Nabble.com.
:
:
: --
: PHP Database Mailing List (http://www.php.net/)
: To unsubscribe, visit: http://www.php.net/unsub.php
:
From: Chris on

> It means that either your mysql conenction details are not correctly set or
> the connection resource isn't accessible for your mysql functions. I suggest
> you first try by replacing:
>
> $link = mysql_pconnect('localhost', 'root', 'testing');
>
> into:
>
> mysql_pconnect('localhost', 'root', 'testing');

Why? How is that going to help fix the problem?

Personally I'd say to *not* use persistent connections as it will cause
you problems later.

Use a normal connection:

$link = mysql_connect($server, $user, $pass);

--
Postgresql & php tutorials
http://www.designmagick.com/
From: =?ISO-8859-1?Q?Roberto_Carlos_Garc=EDa_Lu=EDs?= on
excuseme but, you can access by terminal? [shell]

ODBC is the user? or is a ODBC database?

Please answer me and i can help you.

**Excuse me my english is bad. :(

El 17/06/2008, a las 06:51 p.m., Chris escribió:

>
>> It means that either your mysql conenction details are not
>> correctly set or
>> the connection resource isn't accessible for your mysql functions.
>> I suggest
>> you first try by replacing:
>>
>> $link = mysql_pconnect('localhost', 'root', 'testing');
>>
>> into:
>>
>> mysql_pconnect('localhost', 'root', 'testing');
>
> Why? How is that going to help fix the problem?
>
> Personally I'd say to *not* use persistent connections as it will
> cause
> you problems later.
>
> Use a normal connection:
>
> $link = mysql_connect($server, $user, $pass);
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

From: "Isaak Malik" on
Because then the connection resource isn't stored in the $link variable and
you will be able to use the mysql functions without passing that variable to
each function.

On Wed, Jun 18, 2008 at 1:51 AM, Chris <dmagick(a)gmail.com> wrote:

>
> > It means that either your mysql conenction details are not correctly set
> or
> > the connection resource isn't accessible for your mysql functions. I
> suggest
> > you first try by replacing:
> >
> > $link = mysql_pconnect('localhost', 'root', 'testing');
> >
> > into:
> >
> > mysql_pconnect('localhost', 'root', 'testing');
>
> Why? How is that going to help fix the problem?
>
> Personally I'd say to *not* use persistent connections as it will cause
> you problems later.
>
> Use a normal connection:
>
> $link = mysql_connect($server, $user, $pass);
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>



--
Isaak Malik
Web Developer