note 59275 added to function.mysql-connect
| From: | Franklin at osu1 dot php dot net | Date: | Thu, 01 Dec 2005 13:19:42 +0000 |
| Subject: | note 59275 added to function.mysql-connect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-99413@lists.php.net to get a copy of this message | ||
Hello,
I have a problem with the connection to my MySQL database server. I am using a Windows XP
Workstation (SP2) with Apache 1.3.33, MySQL 4.1.15 and PHP 4.4.1.
With "MySQL Administrator" it is no problem to connect to the MySQL server and to see the
databases there. This shows me that the MySQL Server is running.
But when I try to connect to the database with my PHP script it is not working. I have tried a lot
of things in the meantime but without success. As far as I understand the support for MySQL is
integrated in PHP 4.4.1 and therefor it is not necessary to include a extension for this in the
PHP.INI file!
My PHP script looks like this:
// =========================================
$mysql_host = "localhost";
$mysql_username = "user";
$mysql_passwort = "password";
$mysql_db = "database";
$linkid =
mysql_connect("$mysql_host","$mysql_username","$mysql_passwort")
or die ("Error: Connect to the database not possible!");
mysql_select_db("$mysql_db")
or die ("Error: Database could not be selected!");
//==========================================
With this script I am not able to login to the database. When I use the same user in "MySQL
Administrator" it is working!
Does anybody has an idea what the problem could be?
Many thanks in advance!
Franklin
----
Manual Page -- http://www.php.net/manual/en/function.mysql-connect.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+59275
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59275&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59275&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59275&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59275&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59275&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59275&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59275&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+59275&report=yes
Search -- http://master.php.net/manage/user-notes.php