[thelist] PHP/MySQL help

sasha spam at bittersweet2.com
Thu Dec 19 17:07:01 CST 2002


On Thu, 19 Dec 2002 22:43:39 -0000, Tony Crockford <tonyc at boldfish.co.uk>
wrote:

> Hi all.
>
> I've got a weird one.
>
> I've got a mySQL database that was behaving perfectly well.
>
> It's updated by some PHP forms - read it, allow editing, save changes
> etc.
>
> All that was working fine.
>
> there's a field (vcategory) in the item table that is for future
> purposes, it's set up as int(11) null=yes default 0 (reading the
> PHPmyadmin table view)
>
> we've been doing database updates outside the PHP - importing records
> and somehow the vcategory fields on most of the records are now empty.
> (i.e contain nothing)
>
> If I try to edit these records (in my PHP forms) the save doesn't "take"
>
> 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 was working on a project a few weeks ago and couldn't understand why my
session variable "dir" (being called as $_SESSION['dir']) wasn't being
passed to the next page.  My problem was that registered globals were on,
and a variable of "dir" (being called as $dir) in my template file was
overwriting my session variable, which was being called later in the
script.

More likely, though, it sounds like the query simply isn't sending the
correct variable (or isn't even attempting to update that field).  Try a
print_r($_POST) (don't forget to encase it in pre tags) on the page that
does your processing to make sure the variables you want are even being
passed.  If that's fine, try printing out your query.

--
sasha



More information about the thelist mailing list