Error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
The database I am using is my school's server, so I don't have admin rights to it. Could someone shed some light on what my issue may be? I'm certain my credentials work.
Here is my PHP code:
<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>