Valoare prestabilita la coloana in baza de date
Scris: Sâm Feb 13, 2016
Cod: Selectaţi tot
$link = mysqli_connect("localhost", "", "", "");
// Check connection
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
// Escape user inputs for security
$first_name = mysqli_real_escape_string($link, $_POST['username']);
$last_name = mysqli_real_escape_string($link, $_POST['nume']);
$email_address = mysqli_real_escape_string($link, $_POST['email']);
$password = mysqli_real_escape_string($link, md5($_POST['pass']));
// attempt insert query execution
$sql = "INSERT INTO nky_users (name, username, email, password, block) VALUES ('$nume', '$username', '$email', )";
if(mysqli_query($link, $sql)){
echo "Records added successfully.";
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
// close connection
mysqli_close($link);