Re: I Can't connect to MySql using ADODB

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

 



> Tony Aldemir wrote:
>
> >Hi There,
> >
> >I am trying to connect to MySQL using ADODB library for PHP using the
> >following code with no success.  What am I doing wrong?
> >
> ><?php
> >include('/php/adodb.inc.php');
> >
> >$db = &ADONewConnection('mysql'); # eg. 'mysql' or 'oci8'
> >$db->debug = true;
> >$db->Connect('localhost', 'tony', 'mypassword', 'test');
> >$rs = $db->Execute('select * from users');
> >print "<pre>";
> >print_r($rs->GetRows());
> >print "</pre>";
> >?>
> >
> >Notes:
> >1) After unzipping the downloaded ADODB file into a directory, I copied
the
> >adodb.inc.php file by itself into my c:\PHP directory.  The ADODB
> >documentation says "Unpack all the files into a directory accessible by
your
> >webserver".  What does this mean?  Is there a setting somewhere in the
> >Apache Server that I need to tweak (e.g. some sort of setting in the
> >httpd.conf)?
> >
> >2) By the way, I CAN connect to MySQL using PHP directly (i.e. without
the
> >use of ADODB) just fine and work with the 'test' database's 'users'
table.
> >
> >
> >
> "Unpack all the files into a directory accessible by your webserver" means
placing those files either in the htdocs folder or a folder below that one.
ie Unless you have fiddled with Apache settings in httpd.conf Apache
controls what folders browsers can see on your server and the default is as
I have stated above.
> An example would be my setup which is http://localhost/Kiosk/debug.html
and it finds my adodb files in c:\Pogram Files\Apache
Group\Apache2\htdocs\Kiosk\adodb. From that you can see, if I have explained
clearly enough, that a browser looking at http://localhost/Kiosk/debug.html
cannot "see" anything below c:\Program Files\Apache
Group\Apache2\htdocs\Kiosk and for that matter I could place the debug.html
in htdocs rather than Kiosk and the browser command would be
http://localhost/debug.html in other words Apache defaults to htdocs as the
root.
>


Further to this, you can set the include_path in php.ini. It is generally
recommended to put these files outside the webroot (htdocs as described
above).

More information

http://uk2.php.net/manual/en/ini.core.php#ini.include-path

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux