php-windows Digest 15 Sep 2005 11:28:59 -0000 Issue 2773
Topics (messages 26326 through 26327):
I Can't connect to MySql using ADODB
26326 by: Tony Aldemir
26327 by: Alf Stockton
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
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.
Any help will be greatly appreciated.
Regards,
Tony
-----Original Message-----
From: Mark Rees [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 13, 2005 7:18 AM
To: [email protected]
Subject: Re: [PHP-WIN] Re: mssql equivalents to mysql_errno & mysql_error
Thanks for your advice.
ADODB link
http://adodb.sourceforge.net/
Please use reply all to send your message to the list
-----------------------------------------
in my experience is better to use an abstraction layer library like adodb
this will allow you to switch database in the future, besides that provides
error control and debug options and it is extremly easy to develop with.
Luck!
I have looked in the online manual but am not able to find the
equivalent functions in mssql of mysql_errno() & mysql_error().
I am in the unfortunate position of having to develop using an existing
MSSQL database.
There aren't any as far as I know. I think the best you can do is test for
the existence of whatever you are looking for (connection, result set etc)
at each stage and do something graceful. Not much use for debugging though.
--- End Message ---
--- Begin Message ---
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.
--
Regards,
Alf Stockton www.stockton.co.za
You will be the last person to buy a Chrysler.
My email disclaimer is available at www.stockton.co.za/disclaimer.html
--- End Message ---