I'm trying to create a php form that for registering the user and store their information in MySQL table. Here is the error following that a PHP code and the MySQL table.
Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /hsphere/local/home/khalidalomar/khalidalomar.com/talent/added.php on line 22 Warning: mysql_query(): A link to the server could not be established in /hsphere/local/home/khalidalomar/khalidalomar.com/talent/added.php on line 22 Invalid query: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Here is my PHP code
include("connect.php");
// Talent table
$t_username = strip_tags(substr($_POST['t_username'],0,32));
$t_password = strip_tags(substr($_POST['t_password'],0,32));
$t_fname = strip_tags(substr($_POST['t_fname'],0,32));
$t_lname = strip_tags(substr($_POST['t_lname'],0,32));
$t_cname = strip_tags(substr($_POST['t_cname'],0,32));
$t_phone = strip_tags(substr($_POST['t_phone'],0,32));
$t_description = strip_tags(substr($_POST['t_description'],0,32));
$t_tags = strip_tags(substr($_POST['t_tags'],0,32));
$results = mysql_query("INSERT INTO talents (id, t_username, t_password, t_fname, t_lname, t_cname, t_phone, t_description, t_tags, t_approved, t_dateofreg)
VALUES ('', '$t_username', '$t_password', '$t_fname', '$t_lname', '$t_cname', '$t_phone', '$t_description', '$t_tags', 'N', NOW() )"); // store date by NOW() // date int(8)
if($results) { echo "Successfully Added"; } else { die('Invalid query: '.mysql_error()); }
?>
if you needed the SQL query I could provide that.
connect.phptoo since this is a connect to the database problem, not a failed query...xxxthem out before posting.... there is no connect call to the database in the code you posted here, so either it is inconnect.phpor you are missing something...