May be try something like this:
CREATE TABLE contacts(
id int(16) NOT NULL auto_increment,
phone varchar(15) NOT NULL,
name varchar(15) NOT NULL,
address varchar(15) NOT NULL,
PRIMARY KEY (id)
$query2 = "INSERT INTO contacts VALUES ('NULL','$phone', '$name',
id incremented automatically by MYSQL now
Maybe - but it's by accident. You're trying to insert the word NULL into
an int field (it's being treated as a word because of the single quotes
Don't specify the id field at all:
$query2 = "insert into contacts(phone, name, address) values ('" .
mysql_real_escape_string($_POST['phone']) . "', '" .
mysql_real_escape_string($_POST['name']) . "', '" .
mysql_real_escape_string($_POST['address']) . "')";
You should always use the field names (as above) because if your table
gets reordered, your inserts will now break - if you put "name" before
phone, the data is now going into the wrong fields.
Postgresql & php tutorials
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php