Constraint Violation when INSERT

This is a discussion on Constraint Violation when INSERT within the PHP General forums, part of the PHP Programming Forums category; Hi all, I got the error " Constraint Violation " when I did an "INSERT" . Gone thru the ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-10-2003
irinchiang@justeducation.com
 
Posts: n/a
Default Constraint Violation when INSERT



Hi all,

I got the error " Constraint Violation " when I did an "INSERT" .
Gone thru the code umpteen times but to no avail..Wondering where my error
was??...Below is a snip of the block of code:

----------------------------------------------------
<?
$dsn = "mysql://root:**********@localhost/tablename";

$db = DB::connect ($dsn);
if (DB::isError ($db))
die ($db->getMessage());


//create variables ready to go into DB

$tutor_name = $db->quote($_POST["tutor_name"]);
$tutor_contact = $db->quote($_POST["tutor_contact"]);
$tutor_email = $db->quote($_POST["tutor_email"]);
$tutor_profile = $db->quote($_POST["tutor_profile"]);


$sql = "INSERT INTO tutor (tutor_name, tutor_contact, tutor_email,
tutor_profile)
VALUES ($tutor_name,$tutor_contact,$tutor_email,$tutor_pr ofile)";


$result = $db->query($sql);
if( DB::isError($result) ) {
die ($result->getMessage());
}
?>

-----------------------------------------------------------------------
Everything was fine and the "INSERT" works, user input was insert into the
database successful using the same block of code but the next thing i know I
got this error ....anyone know watz the proz here???
Hope to get some help soon. Thanks in advance=)

Irin.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:40 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0