Help with inserting null values in postgres database
Posted: Mon Mar 31, 2008 9:48 pm
Hi,
I have a postgres database, and the table customer keeps some data, such as first name, last name, tel, email, etc.
Now I'm building a web application and I want to insert values into the above table.
So I made a form so the user can enter the data.
And then a query
$query = "insert into customer (first_name, last_name, tel1, tel2, mobile, email) values ('".$_POST['first_name']."', '".$_POST['last_name']."', '".$_POST['tel1']."', '".$_POST['tel2']."', '".$_POST['mobile']."', '".$_POST['email']."');
tel1, tel2, mobile are numeric in the database.
When I leave a field blank in the input fields, I want a null value in the database!! But this doesn't seem to happen.
Any ideas?
Thanx in advance
I have a postgres database, and the table customer keeps some data, such as first name, last name, tel, email, etc.
Now I'm building a web application and I want to insert values into the above table.
So I made a form so the user can enter the data.
And then a query
$query = "insert into customer (first_name, last_name, tel1, tel2, mobile, email) values ('".$_POST['first_name']."', '".$_POST['last_name']."', '".$_POST['tel1']."', '".$_POST['tel2']."', '".$_POST['mobile']."', '".$_POST['email']."');
tel1, tel2, mobile are numeric in the database.
When I leave a field blank in the input fields, I want a null value in the database!! But this doesn't seem to happen.
Any ideas?
Thanx in advance