I have the php:
$con=mysqli_connect("127.0.0.1","foo","bar","quaz");
if($con){
$sql = "INSERT INTO `virtual_users` (`domain_id`, `password` , `email`)
VALUES ('2', ENCRYPT('".$password."', CONCAT('\$6\$', SUBSTRING(SHA(RAND()), -16))), '".$user."@".$domain."');";
$query = mysqli_query($con, $sql);
if(!$query){
echo $sql;
}else{
echo "Success adding new email user!";
}
}
For some reason when I run this query it always returns $sql
. This means that the connection is fine but the query is not.
When I then run the the echo of $sql
directly on the mysql database it works perfectly!! I have no idea what is going wrong! Any ideas?