473,508 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Connect to MySQL Database using PHP

Hi all. I am trying to connect to a MySQL Database using PHP on a
local machine using locahost. I am using the following code

<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'password';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or
die ('Error connecting to mysql');

$dbname = 'pmoneytest';
mysql_select_db($dbname);
?>

When I view the page it then comes up with an error that says
PHP Fatal error: Call to undefined function mysql_connect() in C:
\Inetpub\wwwroot\PHPTest\connection.php on line 6. I can't see what
the problem is as I got the code from the Internet and it seems to be
the same on all the different website that I look at.

Thanks very much for your help and I look forward to hearing from you
in the near future.

May 7 '07 #1
9 3165
On May 7, 3:59 pm, christopher_bo...@yahoo.co.uk wrote:
Hi all. I am trying to connect to a MySQL Database using PHP on a
local machine using locahost. I am using the following code

<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'password';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or
die ('Error connecting to mysql');

$dbname = 'pmoneytest';
mysql_select_db($dbname);
?>

When I view the page it then comes up with an error that says
PHP Fatal error: Call to undefined function mysql_connect() in C:
\Inetpub\wwwroot\PHPTest\connection.php on line 6. I can't see what
the problem is as I got the code from the Internet and it seems to be
the same on all the different website that I look at.

Thanks very much for your help and I look forward to hearing from you
in the near future.
Make sure that you've enabled the MySQL extension in php.ini. You can
check this by running the following script and examining the output:

<?php
phpinfo();
?>

May 7 '07 #2
On 7 May, 21:11, ZeldorBlat <zeldorb...@gmail.comwrote:
On May 7, 3:59 pm, christopher_bo...@yahoo.co.uk wrote:


Hi all. I am trying to connect to a MySQL Database using PHP on a
local machine using locahost. I am using the following code
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'password';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or
die ('Error connecting to mysql');
$dbname = 'pmoneytest';
mysql_select_db($dbname);
?>
When I view the page it then comes up with an error that says
PHP Fatal error: Call to undefined function mysql_connect() in C:
\Inetpub\wwwroot\PHPTest\connection.php on line 6. I can't see what
the problem is as I got the code from the Internet and it seems to be
the same on all the different website that I look at.
Thanks very much for your help and I look forward to hearing from you
in the near future.

Make sure that you've enabled the MySQL extension in php.ini. You can
check this by running the following script and examining the output:

<?php
phpinfo();
?>- Hide quoted text -

- Show quoted text -
Hi. I have checked the phpinfo(); and MySQL seems to be ok as it is
pointing to where the server is installed. But the internet page still
doesn't work. Is there anything else that I can try.

May 7 '07 #3
ch***************@yahoo.co.uk wrote:
On 7 May, 21:11, ZeldorBlat <zeldorb...@gmail.comwrote:
>On May 7, 3:59 pm, christopher_bo...@yahoo.co.uk wrote:


>>Hi all. I am trying to connect to a MySQL Database using PHP on a
local machine using locahost. I am using the following code
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'password';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or
die ('Error connecting to mysql');
$dbname = 'pmoneytest';
mysql_select_db($dbname);
?>
When I view the page it then comes up with an error that says
PHP Fatal error: Call to undefined function mysql_connect() in C:
\Inetpub\wwwroot\PHPTest\connection.php on line 6. I can't see what
the problem is as I got the code from the Internet and it seems to be
the same on all the different website that I look at.
Thanks very much for your help and I look forward to hearing from you
in the near future.
Make sure that you've enabled the MySQL extension in php.ini. You can
check this by running the following script and examining the output:

<?php
phpinfo();
?>- Hide quoted text -

- Show quoted text -

Hi. I have checked the phpinfo(); and MySQL seems to be ok as it is
pointing to where the server is installed. But the internet page still
doesn't work. Is there anything else that I can try.
Christopher,

Does phpinfo() have a mysql section? It will have items like:

Active Persistent Links 0
Active Links 0
Client API version 5.0.32
MYSQL_MODULE_TYPE external

and so on.

Your symptom is indicates that the mysql extension is not loaded in php.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 7 '07 #4
On 7 May, 23:14, Jerry Stuckle <jstuck...@attglobal.netwrote:
christopher_bo...@yahoo.co.uk wrote:
On 7 May, 21:11, ZeldorBlat <zeldorb...@gmail.comwrote:
On May 7, 3:59 pm, christopher_bo...@yahoo.co.uk wrote:
>Hi all. I am trying to connect to a MySQL Database using PHP on a
local machine using locahost. I am using the following code
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'password';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or
die ('Error connecting to mysql');
$dbname = 'pmoneytest';
mysql_select_db($dbname);
?>
When I view the page it then comes up with an error that says
PHP Fatal error: Call to undefined function mysql_connect() in C:
\Inetpub\wwwroot\PHPTest\connection.php on line 6. I can't see what
the problem is as I got the code from the Internet and it seems to be
the same on all the different website that I look at.
Thanks very much for your help and I look forward to hearing from you
in the near future.
Make sure that you've enabled the MySQL extension in php.ini. You can
check this by running the following script and examining the output:
<?php
phpinfo();
?>- Hide quoted text -
- Show quoted text -
Hi. I have checked the phpinfo(); and MySQL seems to be ok as it is
pointing to where the server is installed. But the internet page still
doesn't work. Is there anything else that I can try.

Christopher,

Does phpinfo() have a mysql section? It will have items like:

Active Persistent Links 0
Active Links 0
Client API version 5.0.32
MYSQL_MODULE_TYPE external

and so on.

Your symptom is indicates that the mysql extension is not loaded in php.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -

- Show quoted text -
Hi. There isn't actually heading called MySQL but it does have Active
Persistent Links 0. The things that you mentioned are not
shown in phpinfo();.

Thanks very much for your help in this matter

May 7 '07 #5
ch***************@yahoo.co.uk wrote:
On 7 May, 23:14, Jerry Stuckle <jstuck...@attglobal.netwrote:
>christopher_bo...@yahoo.co.uk wrote:
>>On 7 May, 21:11, ZeldorBlat <zeldorb...@gmail.comwrote:
On May 7, 3:59 pm, christopher_bo...@yahoo.co.uk wrote:
Hi all. I am trying to connect to a MySQL Database using PHP on a
local machine using locahost. I am using the following code
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'password';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or
die ('Error connecting to mysql');
$dbname = 'pmoneytest';
mysql_select_db($dbname);
?>
When I view the page it then comes up with an error that says
PHP Fatal error: Call to undefined function mysql_connect() in C:
\Inetpub\wwwroot\PHPTest\connection.php on line 6. I can't see what
the problem is as I got the code from the Internet and it seems to be
the same on all the different website that I look at.
Thanks very much for your help and I look forward to hearing from you
in the near future.
Make sure that you've enabled the MySQL extension in php.ini. You can
check this by running the following script and examining the output:
<?php
phpinfo();
?>- Hide quoted text -
- Show quoted text -
Hi. I have checked the phpinfo(); and MySQL seems to be ok as it is
pointing to where the server is installed. But the internet page still
doesn't work. Is there anything else that I can try.
Christopher,

Does phpinfo() have a mysql section? It will have items like:

Active Persistent Links 0
Active Links 0
Client API version 5.0.32
MYSQL_MODULE_TYPE external

and so on.

Your symptom is indicates that the mysql extension is not loaded in php.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -

- Show quoted text -

Hi. There isn't actually heading called MySQL but it does have Active
Persistent Links 0. The things that you mentioned are not
shown in phpinfo();.

Thanks very much for your help in this matter
Check the php.ini( find path with phpinfo()
find and replace for php_mysql.dll
make sure it is enable

example:
with ";" in front of the extention is disable
;extension=php_msql.dll ( disable)
extension=php_mysql.dll ( enable )
hope it work
May 7 '07 #6
ch***************@yahoo.co.uk wrote:
On 7 May, 23:14, Jerry Stuckle <jstuck...@attglobal.netwrote:
>christopher_bo...@yahoo.co.uk wrote:
>>On 7 May, 21:11, ZeldorBlat <zeldorb...@gmail.comwrote:
On May 7, 3:59 pm, christopher_bo...@yahoo.co.uk wrote:
Hi all. I am trying to connect to a MySQL Database using PHP on a
local machine using locahost. I am using the following code
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'password';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or
die ('Error connecting to mysql');
$dbname = 'pmoneytest';
mysql_select_db($dbname);
?>
When I view the page it then comes up with an error that says
PHP Fatal error: Call to undefined function mysql_connect() in C:
\Inetpub\wwwroot\PHPTest\connection.php on line 6. I can't see what
the problem is as I got the code from the Internet and it seems to be
the same on all the different website that I look at.
Thanks very much for your help and I look forward to hearing from you
in the near future.
Make sure that you've enabled the MySQL extension in php.ini. You can
check this by running the following script and examining the output:
<?php
phpinfo();
?>- Hide quoted text -
- Show quoted text -
Hi. I have checked the phpinfo(); and MySQL seems to be ok as it is
pointing to where the server is installed. But the internet page still
doesn't work. Is there anything else that I can try.
Christopher,

Does phpinfo() have a mysql section? It will have items like:

Active Persistent Links 0
Active Links 0
Client API version 5.0.32
MYSQL_MODULE_TYPE external

and so on.

Your symptom is indicates that the mysql extension is not loaded in php.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -

- Show quoted text -

Hi. There isn't actually heading called MySQL but it does have Active
Persistent Links 0. The things that you mentioned are not
shown in phpinfo();.

Thanks very much for your help in this matter
OK, then the MySQL extension is not loaded. You need to add it in your
php.ini file.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 7 '07 #7
On 7 May, 23:38, Daniele <"dankan775{["@]}yahoo.itwrote:
christopher_bo...@yahoo.co.uk wrote:
On 7 May, 23:14, Jerry Stuckle <jstuck...@attglobal.netwrote:
christopher_bo...@yahoo.co.uk wrote:
On 7 May, 21:11, ZeldorBlat <zeldorb...@gmail.comwrote:
On May 7, 3:59 pm, christopher_bo...@yahoo.co.uk wrote:
Hi all. I am trying to connect to a MySQL Database using PHP on a
local machine using locahost. I am using the following code
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'password';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or
die ('Error connecting to mysql');
$dbname = 'pmoneytest';
mysql_select_db($dbname);
?>
When I view the page it then comes up with an error that says
PHP Fatal error: Call to undefined function mysql_connect() in C:
\Inetpub\wwwroot\PHPTest\connection.php on line 6. I can't see what
the problem is as I got the code from the Internet and it seems to be
the same on all the different website that I look at.
Thanks very much for your help and I look forward to hearing from you
in the near future.
Make sure that you've enabled the MySQL extension in php.ini. You can
check this by running the following script and examining the output:
<?php
phpinfo();
?>- Hide quoted text -
- Show quoted text -
Hi. I have checked the phpinfo(); and MySQL seems to be ok as it is
pointing to where the server is installed. But the internet page still
doesn't work. Is there anything else that I can try.
Christopher,
Does phpinfo() have a mysql section? It will have items like:
Active Persistent Links 0
Active Links 0
Client API version 5.0.32
MYSQL_MODULE_TYPE external
and so on.
Your symptom is indicates that the mysql extension is not loaded in php.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -
- Show quoted text -
Hi. There isn't actually heading called MySQL but it does have Active
Persistent Links 0. The things that you mentioned are not
shown in phpinfo();.
Thanks very much for your help in this matter

Check the php.ini( find path with phpinfo()
find and replace for php_mysql.dll
make sure it is enable

example:
with ";" in front of the extention is disable
;extension=php_msql.dll ( disable)
extension=php_mysql.dll ( enable )

hope it work- Hide quoted text -

- Show quoted text -
Hi. I have enabled extension=php_mysql.dll and when I go onto
phpinfo(); it then comes up with an error that says

PHP Warning: PHP Startup: Unable to load dynamic library './
php_msql.dll' - The specified module could not be found. in Unknown on
line 0 PHP Warning: PHP Startup: Unable to load dynamic library './
php_mysql.dll' - The specified module could not be found. in Unknown
on line 0.

What can I try now

May 9 '07 #8
ch***************@yahoo.co.uk wrote:
On 7 May, 23:38, Daniele <"dankan775{["@]}yahoo.itwrote:
>christopher_bo...@yahoo.co.uk wrote:
>>On 7 May, 23:14, Jerry Stuckle <jstuck...@attglobal.netwrote:
christopher_bo...@yahoo.co.uk wrote:
On 7 May, 21:11, ZeldorBlat <zeldorb...@gmail.comwrote:
>On May 7, 3:59 pm, christopher_bo...@yahoo.co.uk wrote:
>>Hi all. I am trying to connect to a MySQL Database using PHP on a
>>local machine using locahost. I am using the following code
>><?php
>>$dbhost = 'localhost';
>>$dbuser = 'root';
>>$dbpass = 'password';
>>$conn = mysql_connect($dbhost, $dbuser, $dbpass) or
>>die ('Error connecting to mysql');
>>$dbname = 'pmoneytest';
>>mysql_select_db($dbname);
>>?>
>>When I view the page it then comes up with an error that says
>>PHP Fatal error: Call to undefined function mysql_connect() in C:
>>\Inetpub\wwwroot\PHPTest\connection.php on line 6. I can't see what
>>the problem is as I got the code from the Internet and it seems to be
>>the same on all the different website that I look at.
>>Thanks very much for your help and I look forward to hearing from you
>>in the near future.
>Make sure that you've enabled the MySQL extension in php.ini. You can
>check this by running the following script and examining the output:
><?php
>phpinfo();
>?>- Hide quoted text -
>- Show quoted text -
Hi. I have checked the phpinfo(); and MySQL seems to be ok as it is
pointing to where the server is installed. But the internet page still
doesn't work. Is there anything else that I can try.
Christopher,
Does phpinfo() have a mysql section? It will have items like:
Active Persistent Links 0
Active Links 0
Client API version 5.0.32
MYSQL_MODULE_TYPE external
and so on.
Your symptom is indicates that the mysql extension is not loaded in php.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -
- Show quoted text -
Hi. There isn't actually heading called MySQL but it does have Active
Persistent Links 0. The things that you mentioned are not
shown in phpinfo();.
Thanks very much for your help in this matter
Check the php.ini( find path with phpinfo()
find and replace for php_mysql.dll
make sure it is enable

example:
with ";" in front of the extention is disable
;extension=php_msql.dll ( disable)
extension=php_mysql.dll ( enable )

hope it work- Hide quoted text -

- Show quoted text -

Hi. I have enabled extension=php_mysql.dll and when I go onto
phpinfo(); it then comes up with an error that says

PHP Warning: PHP Startup: Unable to load dynamic library './
php_msql.dll' - The specified module could not be found. in Unknown on
line 0 PHP Warning: PHP Startup: Unable to load dynamic library './
php_mysql.dll' - The specified module could not be found. in Unknown
on line 0.

What can I try now
Do you have the libmysql.dll installed in a directory in your PATH
statement?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 9 '07 #9

Jerry Stuckle wrote:
ch***************@yahoo.co.uk wrote:
On 7 May, 23:38, Daniele <"dankan775{["@]}yahoo.itwrote:
christopher_bo...@yahoo.co.uk wrote:
On 7 May, 23:14, Jerry Stuckle <jstuck...@attglobal.netwrote:
christopher_bo...@yahoo.co.uk wrote:
On 7 May, 21:11, ZeldorBlat <zeldorb...@gmail.comwrote:
On May 7, 3:59 pm, christopher_bo...@yahoo.co.uk wrote:
>Hi all. I am trying to connect to a MySQL Database using PHP on a
>local machine using locahost. I am using the following code
><?php
>$dbhost = 'localhost';
>$dbuser = 'root';
>$dbpass = 'password';
>$conn = mysql_connect($dbhost, $dbuser, $dbpass) or
>die ('Error connecting to mysql');
>$dbname = 'pmoneytest';
>mysql_select_db($dbname);
>?>
>When I view the page it then comes up with an error that says
>PHP Fatal error: Call to undefined function mysql_connect() in C:
>\Inetpub\wwwroot\PHPTest\connection.php on line 6. I can't see what
>the problem is as I got the code from the Internet and it seems to be
>the same on all the different website that I look at.
>Thanks very much for your help and I look forward to hearing from you
>in the near future.
Make sure that you've enabled the MySQL extension in php.ini. You can
check this by running the following script and examining the output:
<?php
phpinfo();
?>- Hide quoted text -
- Show quoted text -
Hi. I have checked the phpinfo(); and MySQL seems to be ok as it is
pointing to where the server is installed. But the internet page still
doesn't work. Is there anything else that I can try.
Christopher,
Does phpinfo() have a mysql section? It will have items like:
Active Persistent Links 0
Active Links 0
Client API version 5.0.32
MYSQL_MODULE_TYPE external
and so on.
Your symptom is indicates that the mysql extension is not loaded in php.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -
- Show quoted text -
Hi. There isn't actually heading called MySQL but it does have Active
Persistent Links 0. The things that you mentioned are not
shown in phpinfo();.
Thanks very much for your help in this matter
Check the php.ini( find path with phpinfo()
find and replace for php_mysql.dll
make sure it is enable

example:
with ";" in front of the extention is disable
;extension=php_msql.dll ( disable)
extension=php_mysql.dll ( enable )

hope it work- Hide quoted text -

- Show quoted text -
Hi. I have enabled extension=php_mysql.dll and when I go onto
phpinfo(); it then comes up with an error that says

PHP Warning: PHP Startup: Unable to load dynamic library './
php_msql.dll' - The specified module could not be found. in Unknown on
line 0 PHP Warning: PHP Startup: Unable to load dynamic library './
php_mysql.dll' - The specified module could not be found. in Unknown
on line 0.

What can I try now

Do you have the libmysql.dll installed in a directory in your PATH
statement?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Hi. I have managed to get it working. The problem was that I had to
copy the dll files that were in a zip file to the root of the php
program folder.

May 9 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
4777
by: Mr Dygi | last post by:
Hi, PHP 4.3.4 installed manually from package *.zip and Apache 2. I have a problem with this simple code: <?php $link = mysql_connect("127.0.0.1","","") or die("Could not connect: " ....
6
6472
by: Eric W. Holzapfel | last post by:
Hello PHP group, I have mysql running on a linux box. I have apache (2.0.4) running on a diff linux box. I have php 4.X. I can connect to the mysql db using odbc from a windows box, but...
1
3288
by: Marc | last post by:
Hello, Newbie here..... Searching and working this for a week now. We too are having the same problems. Using MySql 4.0.14 and there are "no problems" at all.
7
5560
by: atlasyeo | last post by:
Hi, my first time posting on a newsgroup. anyway, let's cut to the chase. I'm trying to migrate mysql database form one server to another server. So I copied the data from /var/lib/mysql to the...
4
5328
by: bettina | last post by:
Hello, My domain: www.coaster.ch My database: coasters User: bettina In the programm I wrote: <?php $db_server = "www.coaster.ch";
2
10482
by: zMisc | last post by:
I am using VB.NET 1.1 and cannot connect to a MySQL (v5) database. I've done the following: 1) Create a DSN for MyODBC. 2) Connect using: Driver=MySQL ODBC 3.51 Driver; Server=localhost; Data...
5
4546
by: news.telia.net | last post by:
Hi! I have a question. I have installed php and mysql on an apache-server on windows and I can't connect to the server. I tried to create a database (since I am trying to learn howto). My...
2
22525
by: Martin | last post by:
Hi all. I have a fully functional page hosted on my PC that uses PHP and connects to MySQL on my PC to generate it's code. I now have some web hosting available which includes both PHP and...
2
9370
by: 111mike | last post by:
Hello, Here's my problem. I cannot connect to mysql database using odbc string connections or dns. I keep getting a "cannot connect to mysql server localhost." I'm running windows XP Pro and...
10
5479
nathj
by: nathj | last post by:
Hi there, This thread is very similar to an earlier thread but I didn't want to hijack a thread. The issue is this. I have a mysql database on my local machine, I have installed the driver for...
0
7226
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7049
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5631
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1561
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
422
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.