Re: PHP-MySQL connection for particular module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx> 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

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux