为什么PHP中没有定义这个mysql函数?
这是我的数据库映像: 此行中的错误:为什么PHP中没有定义这个mysql函数?,php,insert,Php,Insert,这是我的数据库映像: 此行中的错误: $con = mysql_connect("localhost","root",""); 错误: 致命错误:未捕获错误:调用C:\xampp\htdocs\Trial\insert.php中未定义的函数mysql_connect():6堆栈跟踪:#0{main}在第6行的C:\xampp\htdocs\Trial\insert.php中抛出 检查您的php版本my callingecho phpinfo(),我想这是版本问题,PHP7不支持mysql功能
$con = mysql_connect("localhost","root","");
错误:
致命错误:未捕获错误:调用C:\xampp\htdocs\Trial\insert.php中未定义的函数mysql_connect():6堆栈跟踪:#0{main}在第6行的C:\xampp\htdocs\Trial\insert.php中抛出
检查您的php版本my calling
echo phpinfo()
,我想这是版本问题,PHP7不支持mysql功能,请改用mysqli,它会对您有用除非您使用PHP5.6或更低版本,否则mysql功能将无法工作。该函数在PHP7.0+中被删除。您应该使用(见下文)或
您使用的是哪个PHP版本?mysql_*lib已从PHP7中删除。的可能重复
// If your local DB connection is default
$host = 'localhost';
$username = 'root';
$password = '';
$database = 'YOUR_DB_NAME';
$con = mysqli_connect('$host',$username',$password,$database);