Nu face insert in db
Scris: Mie Mai 04, 2011
Buna...am si eu o problema la care nu mai inteleg nimica. Am acest cod:
Cand il accesez in browser imi apare pagina alba, fara erroare, fara nimica. Cand intru in db, aceasi problema, nu o adaugat nimica...Ce problema ar putea sa aiba?:(thx
Cod: Selectaţi tot
<?php
include("config.php");
$user = $_POST['user'];
$name = $_POST['name'];
$last_name = $_POST['surname'];
$email = $_POST['email'];
$password = $_POST['password'];
$country = $_POST['country'];
$day_born=$_POST['day'];
$month_born=$_POST['luna'];
$year_born=$_POST['year'];
$ip = $_SERVER['REMOTE_ADDR'];
$date = data('d.m.Y');
$ora = date("H:i:s", time());
$actual_year = date('Y');
$age = $actual_year - $year_born;
mysql_connect("$db_host", "$db_user", "$db_pass") or die("ERROR");
mysql_select_db("$db_name") or die("ERROR 2");
$actiune = "INSERT INTO users (username, first_name, last_name, email, country, password, sex, description, day_born, month_born, year_born, age, last_login, ip, date)
VALUES ('$user', '$name', '$last_name', '$email', '$country', '$password', 'your description', '$day_born', '$month_born', '$year_born', '$age', '10.03.2011', '$ip', '$date - $ora')";
$query = mysql_query($actiune);
if($query){
echo "You have registered successfully";
}else{
echo "ERROR Please try again later";
}
mysql_close();
?>