[thelist] PHP/MySQL help - solved

Tony Crockford tonyc at boldfish.co.uk
Thu Dec 19 18:29:01 CST 2002

> > but if I edit the record (in PHPmyadmin or my forms) and
> set vcategory
> > to 0 the save does "take".
> >
> > Can anyone shed any light on why this might be?
> >
> > I guess all I have to do is update the field to 0 and then all my
> > records will become editable again, but I'd really like to
> know why this
> > one thing would cause an update to fail.
> >
> > Cheers
> >
> > Tony
> >
> What does your query/code look like?  Are you certain that
> you aren't using
> a variable of the same name as the one you're trying to update your
> category with?  Are registered globals on or off?

I found the problem:

		$savequery="Update item Set cat1_ref=$cat1dd,
sub_cat1_ref=$sub_cat1_ref, cat2_Ref=$cat2dd,
sub_cat2_ref=$sub_cat2_ref, item_title='$item_title',
key_words='$key_words', description='$description', format='$format',
thumbnail_ref='$thumbnail_ref', file_ref='$file_ref',status='$status',
archive_ref='$archive_ref', vcategory=$vcategory where

note the missing '' around the variable $vcategory.

I'm assuming that this means that a space in the form field $vcategory
is not translated to a null for mySQL but some other illegal character
which causes the update to fail. (but fail silently)

anyone got any hints on how to generate a mySQL error to highlight
problems of this type in future?



More information about the thelist mailing list