你好今天我正在开发一个php脚本,当在浏览器上运行时会在mysql中创建表但它无法正常工作。
我正在使用xampp与MariaDB 10.1.21和PHp版本7.1.1
<?php
$server = "127.0.0.1";
$username = "root";
$password = "";
$database = "****";
$connId = mysql_connect($server,$username,$password) or die("Cannot connect to server");
$selectDb = mysql_select_db ($database,$connId) or die("Cannot connect to database");
$result = "CREATE TABLE track(
`id` int(6) NOT NULL auto_increment,
`tm` varchar(20) NOT NULL default '',
`ref` varchar(250) NOT NULL default '',
`agent` varchar(250) NOT NULL default '',
`ip` varchar(20) NOT NULL default '',
`ip_value` int(11) NOT NULL default '0',
`domain` varchar(20) NOT NULL default '',
`tracking_page_name` varchar(10) NOT NULL default '',
UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ";
if (mysql_query($result))
{
print "Success in TABLE creation!......";
}
else
{
die('MSSQL error: ' . mssql_get_last_message());
}
?>'
它给了我这个错误致命错误:未捕获错误:在C:\ xampp \ htdocs \ fix \ create_table_track.php中调用未定义函数mysql_connect():8堆栈跟踪:#0 {main}抛出C:第8行\ xampp \ htdocs \ fix \ create_table_track.php