错误:无法通过套接字'/var/lib/mysql/mysql.sock'连接到本地MySQL服务器(2)
我使用的数据库是我学校的服务器,因此我没有管理员权限。有人可以解释我的问题可能是什么吗?我确信我的证书有效。
这是我的PHP代码:
<html>
<body>
<?php
$servername = "triton.towson.edu";
$username = "XYZ";
$password = "XYX";
$dbname = "XYZ";
$carrier = $_POST['carrier'];
$rating = $_POST['rating'];
$type = $_POST['typesel'];
$uname = $_POST['uname'];
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = 'INSERT INTO ctrade1db.survey'.
'(carrier, rating, type, username) '.
'VALUES ($carrier, $rating, $type, $uname)';
mysql_query($sql);
if (!mysql_query($sql,$con))
{
die('Error: Not added' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
</body>
</html>