Hi all:
I was having some problem with INSERT query here and do hope to get some help
real soon.
I have a form whereby once the form is submitted, the values entered shall be
inserted into the database. Next I have also written a SELECT query to view the
records which have just been inserted into the database.
Data was able to insert into the database and I was also able to retrieve these
data from database. However, my problem is, whenever a form was being
submitted, it actually INSERT another row of null values into the database. And
so, when I clicked to view my data, i can see the previously inserted values as
well as an empty row of records.
Why is this so? How can I prevent the row of null value to be inserted?
I have included a snip of my code below and hope to get some help real soon.
All help are greatly appreciated. Thanks in advance.
<snip>
$dsn = "mysql://root:[EMAIL PROTECTED]/databaseName";
$db = DB::connect ($dsn);
if (DB::isError ($db))
die ($db->getMessage());
$tutor_name = $_POST["tutor_name"];
$tutor_contact = $_POST["tutor_contact"];
$tutor_email = $_POST["tutor_email"];
$tutor_profile = $_POST["tutor_profile"];
$sql ="INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, tutor_profile)
VALUES('$tutor_name','$tutor_contact','$tutor_email','$tutor_profile')";
$result = $db->query($sql);
if( DB::isError($result) ) {
die ($result->getMessage());
}
?>
</snip>
Is there anything wrong with my SELECT query ??
Thanks in advance.
Regards,
Irin
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php