Solved

Call to undefined function: mysql_create_db()

Posted on 2004-08-19
4
2,114 Views
Last Modified: 2008-01-09
Is it possible to have PHP setup so that it can talk to MySQL?

I'm running a script but getting the error Call to undefined function: mysql_create_db()

Thanks,
0
Comment
Question by:jacobcolton
4 Comments
 
LVL 48

Expert Comment

by:hernst42
ID: 11839902
is the extension for mysql-compiled in PHP or can it be loaded dynamicly:

if (!extension_loaded('mysql')) {
    if (!dl('mysql.so')) {
           die('mysql - extension not available');
    }
}
echo "mysql- available"

for windows ty the line
    if (!dl('php_mysql.dll')) {

If you get the error -message you need to recomplie PHP
0
 
LVL 3

Accepted Solution

by:
Boris Aranovich earned 500 total points
ID: 11840185
It's an old function that is deprecated in new PHP versions, and will not work with MySQL 4.x
You should use mysql_query("CREATE DATABASE ....")

Reference:
PHP mysql_create_db(): http://www.php.net/manual/en/function.mysql-create-db.php
MySQL "CREATE DATABASE": http://dev.mysql.com/doc/mysql/en/CREATE_DATABASE.html
0
 
LVL 8

Expert Comment

by:GEM100
ID: 11841111
PHP has to be compiled using:
--with-mysql=/dir

If you need more details, check this URL: http://www.php.net/manual/en/install.php

And then do as Nomaed suggested, use:

mysql_query("CREATE DATABASE `namegoeshere`");

Also make sure than mysql username that you are using to connect has enough privileges to create databases.
0
 

Expert Comment

by:smartsims
ID: 12890548
Have a look at

http://www.experts-exchange.com/Web/Web_Languages/PHP/PHP_Databases/Q_21087789.html

I plugged a long response about the DLL's for mySQL & PHP in windows
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now