Call to undefined function mysql_create_db()
来源:互联网 发布:香港端口 编辑:程序博客网 时间:2024/05/16 15:21
当我在本机上运行以下代码时出现:Fatal error: Call to undefined function mysql_create_db() in E:/AppServ/www/test3.php on line 5
<?php
$link = mysql_connect("localhost", "root", "123456")
or die("Could not connect: " . mysql_error());
if(mysql_create_db("my_db")) {
print ("Database created successfully/n");
} else {
printf ("Error creating database: %s/n", mysql_error());
}
?>
当我在本机上运行另一段代码时出现:恭喜你,数据库dbname创建成功了!
<?php
$con = mysql_connect('localhost', 'root', '123456');
if (!$con) {
die ('连接数据库出错: ' . mysql_error());
}
$database="dbname";
$sql = 'create database '.$database;
if(mysql_query($sql, $con))
{
echo "恭喜你,数据库".$database."创建成功了!";
}
else
{
echo "创建数据库出错,错误号:".mysql_errno()." 错误原因:".mysql_error();
}
mysql_close();
?>
当出现此类原因时请运行以下代码段:
<?php
$arr = get_defined_functions();
print_r($arr);
?>
在输出页面中搜索“mysql_create_db() ”,结果你会发现搜索不到mysql_create_db() 这个函数。
其实你在PHP手册上搜索mysql_create_db(),你就会发现有这样一条警告:
如果 MySQL 扩展库是基于 MySQL 4.x 客户端库建立的,则本函数不可用。
有空多看看PHP手册是没错的!
- Call to undefined function mysql_create_db()
- Call to undefined function: mcrypt_module_open()
- Call to undefined function: mcrypt_module_open()
- Call to undefined function: mysql_connect()
- Call to undefined function mysql_connect()
- 解决Call to undefined function
- Call to undefined function mysql_connect()
- Call to undefined function curl_init()
- Call to undefined function imagettftext()
- Call to undefined function imagecreate()
- Call to undefined function mssql_connect()
- Call to undefined function ssh2_connect()
- Call to undefined function curl_init
- Call to undefined function curl_init()
- Call to undefined function curl_init()
- Call to undefined function openssl_get_privatekey()
- Call to undefined function curl_init()
- Call to undefined function curl_init()
- 整整60多页的论文
- 使用默记法来简化递归程序的编写
- JAVA Start
- Microsoft Office SharePoint Server 2007(MOSS 2007)简介
- 编写Java GUI的好工具WindowBuilder Pro[包含Swt-Designer和Swing-Designer]
- Call to undefined function mysql_create_db()
- DXperience 7.1.4 for VS2005
- The Linux Programmer's Toolbox ( 刚刚下到,需要的联系我哦)
- 2007年百度之星复赛试题
- 开发驱动程序的过程
- HTML和Javascript混合转义
- UNIX socket编程原理
- SWT Designer 6.0 (Window Builder Pro) 安装及注册方法
- 你是富人还是穷人