I Can't connect to MySql using ADODB

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

 



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:mrees@xxxxxxxxxxxxxxxxx] 
Sent: Tuesday, September 13, 2005 7:18 AM
To: php-windows@xxxxxxxxxxxxx
Subject: Re:  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.

  

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