Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
| Search | Today's Posts | Mark Forums Read
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 18th, 2006, 07:26 AM
Registered User
 
Join Date: May 2006
Location: Arbúcies, , Spain.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help with mysql_connect()

I have got a problem with function mysql_connect(). When I use the function in order to create a database, it returns me thi error:

Fatal error: Call to undefined function mysql_connect() in F:\Apache Group\Apache2\test\createmovie.php on line 4

What can I do?

 
Old May 18th, 2006, 07:38 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

You need to install the mysql extension, it isn't installed by default in PHP 5.

Read the manual and user notes at:
http://www.php.net/mysql



Regards,
Rich

--
Author,
Beginning CSS: Cascading Style Sheets For Web Design
CSS Instant Results

http://www.catb.org/~esr/faqs/smart-questions.html
 
Old May 18th, 2006, 08:08 AM
Registered User
 
Join Date: May 2006
Location: Arbúcies, , Spain.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much, I'll do.

 
Old May 18th, 2006, 08:46 AM
Registered User
 
Join Date: May 2006
Location: Arbúcies, , Spain.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've do it, but I've got
;extension=php_mysql.dll
by default and it continues without working.

 
Old May 24th, 2006, 11:09 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You should probably take a look at using the MySQLi (i==improved) libraries, instead: they're the default in PHP 5, anyway. The others are kinda deprecated.
 
Old May 24th, 2006, 12:01 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

The old "mysql" extension is not marked deprecated, AFAIK. You should, however, use the mysqli extension if MySQL is version 4.1 or later.

> I've do it, but I've got
> ;extension=php_mysql.dll
> by default and it continues without working.

You must uncomment the extension to install it, by removing the semi-colon from in front of it, assuming you are on Windows. You'll also have to place the libmysql.dll file in the system path. Read all about that on the http://www.php.net/mysql page, or http://www.php.net/mysqli if you're using MySQL 4.1 or later.

If you're on a Linux server, you'll want to do something like

yum install mysql mysql-server php-mysql php-mysqli

Or find the RPMs and install them that way, or install from source.

HTH!

Regards,
Rich

--
Author,
Beginning CSS: Cascading Style Sheets For Web Design
CSS Instant Results

http://www.catb.org/~esr/faqs/smart-questions.html




Similar Threads
Thread Thread Starter Forum Replies Last Post
i can not use the mysql_connect() function g.tamilselvan MySQL 2 February 14th, 2006 09:03 AM
Call to undefined function mysql_connect() tks_muthu PHP Databases 2 June 14th, 2005 01:23 AM
mysql_connect() will not connect!!!! crazyfool PHP Databases 3 February 26th, 2005 11:09 AM
undefined function: mysql_connect() shabboleth Beginning PHP 2 September 18th, 2003 05:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.