connection to mysql
| From: | Didier Bretin | Date: | Thu, 20 Feb 2003 09:47:46 +0000 |
| Subject: | connection to mysql | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-3852@lists.php.net to get a copy of this message | ||
Hello,
First configuration: OS:linux php:4.2.3 mysql:3.23.
I did two tests to connect to mysql: one with mysql_connect, and one with
pear. The pear version is not working. I need this to work because I would like
to use a webmail application known as SquirrelMail.
Here is the code:
<?php
require_once('DB.php');
$dsn="mysql://root:xxxx@10.1.64.10:5301/sm_giphar";
$db=DB::connect ( $dsn );
if (DB::isError($db)) {
die ($db->getMessage());
}
$rs=$db->query ( "select * from address" );
while ($row = $rs->fetchRow()) {
$id = $row[0];
echo ( $id );
echo ( "<br>" );
}
?>
As you can see it's very simple. And the error I have is: DB Error: not found.
The mysql_connect code following is working:
$link = mysql_connect("10.1.64.10:5301", "root", "xxxx")
or die("Could not connect");
print "Connected successfully";
mysql_select_db("sm_giphar") or die("Could not select database");
Can anybody help me ?
Regards.
--
.------------------------------------------------.
.^. | Didier Bretin, France | dbr@informactis.com |
/V\ |-----------------------| www.informactis.com |
// \\ | `------------------------|
/( )\ | Visit: http://www.vim.org/ |
^^-^^ `------------------------------------------------'
--
.------------------------------------------------.
.^. | Didier Bretin, France | dbr@informactis.com |
/V\ |-----------------------| www.informactis.com |
// \\ | `------------------------|
/( )\ | Visit: http://www.vim.org/ |
^^-^^ `------------------------------------------------'