我有一个问题,当我写welcome.php时我需要使用mysql_connect()
但是当我运行它时会出现错误:
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/u781677053/public_html/cas/welcome.php:4 Stack trace: #0 {main} thrown in /home/u781677053/public_html/cas/welcome.php on line 4
我正在使用一个名为Hostinger.es的网站,而不是apache或任何东西
代码:
mysql_connect("localhost","u781677053_lo","987654") or die();
mysql_select_db("u781677053_po") or die();
答案 0 :(得分:0)
mysql_*
现已弃用。使用mysqli_*
或PDO
您可以在mysqli_*
中执行以下操作: -
$connect = mysqli_connect("localhost","u781677053_lo","987654","u781677053_po") or die(mysqli_connect_error());