Re: UPDATE tbl problem...
| From: | Jason Wong | Date: | Sun, 15 Dec 2002 07:44:11 +0000 |
| Subject: | Re: UPDATE tbl problem... | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-24155@lists.php.net to get a copy of this message | ||
On Sunday 15 December 2002 09:24, Hartleigh Burton wrote:
> Hi,
>
> I am having a small problem when it comes to updating some tables that I
> have. tblmembers and tbloptions are both linked together with the exact
> same userid #. here is the code i have been using...
>
> mysql_query("UPDATE tbloptions SET
> strColorPref='$tmpColorPref' strTextPref='$tmpTextPref'
> strLinkPref='$tmpLinkPref' strALinkPref='$tmpALinkPref' WHERE
> strIDent='$_SESSION[strIDent]'");
> mysql_query("UPDATE tblmembers SET
> strAction='Successfully updated user settings on $logdate.' WHERE
> strIDent='$_SESSION[strIDent]'");
>
> Now, heres where i am confused, the second update statement for
> tblmembers, works fine, no problems. The variables listed in both
> statements work, i have tested them.
>
> The second statement however does not seem to insert the data into the
> table at all. no errors are returned, all seems good, but the data isn't
> there. i have privileges set for both tables properly. i can't figure it
> out, if anyone can help, please reply. :)
I'm assuming that in your last paragraph you mean the FIRST statement doesn't
work.
First, no errors are returned because you're not testing for it? You should
_always_ use something like:
mysql_query('...') or die(mysql_error());
Second, the reason why it fails is because you need commas between the items
in your SET clause:
UPDATE table SET col1 = 'val1', col2 = 'val2' ...
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Carson's Consolation:
Nothing is ever a complete failure.
It can always be used as a bad example.
*/