RE: [PHP-DB] Transaction suddenly not working
| From: | dpgirago at mdanderson dot org | Date: | Mon, 29 Nov 2004 15:08:42 +0000 |
| Subject: | RE: [PHP-DB] Transaction suddenly not working | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-37444@lists.php.net to get a copy of this message | ||
> --- "Ford, Mike" <M.Ford@leedsmet.ac.uk> wrote:
> > > 0: INSERT INTO Table1 (LurkID, ProfileName, Edu,
> > > WorkAuth, WorkExp, CarLev, Secu, Confi, Relo,
> > > Telecomu, City1, State1, City2, State2,
> > TravelPref,
> > > SalaryAnnual, SalaryHourly, Available) VALUES (47,
> > > 'ffffffff', 7, 2, 1015, 5, , '', '', '',
> > > 'fds', 5,
> > '',
> >
> > You have 2 successive commas in this last line, with
> > no value in between --
> > this is your syntax error.
> >
> > > , 4, 26, , 2004-02-02)01062 : Duplicate entry
> > '0-f' for key 1
> >
> > And again on this line -- twice, in fact, since the
> > previous line ends with
> > a comma, too.
> >
> Mike are you saying that I should put single quotes
> around all values regardless of the type ?
> The double commas are happening because around an int
> I don't use 'value' the single quotes . ?
Don't know about other database engines, but in MySQL, it doesn't matter
if an int is inserted as a string, i.e., with the quotes. My recollection
is that MySQL handles the type conversion internally. So, assuming you are
validating the entries before inserting, if a value is missing, assign to
it ''. Whatever the field has as a default value will then be inserted
into the table.
dave