Re: PHP-MySQL connection for particular module

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

 



Eric,

You gessed right. Both of the files are in my "docroot" directory.
I tried this. Unfortunely, it did not work ( perhaps, I did not use it
right), although, I followed your instructions.

Isaak gave me an idea which solved my problem (see his replies).

Thank you


Eric-275 wrote:
> 
> 
> ----------------------------------------------------
> http://myprojects.srhost.info
> eric{at}myprojects{dot}srhost{dot}info
> ----- Original Message ----- 
> From: "bateivan" <ivanovivans@xxxxxxxx>
> To: <php-db@xxxxxxxxxxxxx>
> Sent: Tuesday, June 17, 2008 11:19 PM
> Subject:  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
> :
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/PHP-MySQL-connection-for-particular-module-tp17915108p18005755.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


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

  Powered by Linux