UPDATE'ing with multiple WHERES

This is a discussion on UPDATE'ing with multiple WHERES within the MySQL Database forums, part of the Database Forums category; So essentially I'm making a basic user online script with a timeout. However, it doesn't seem to be ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-09-2007
Austin Pickett
 
Posts: n/a
Default UPDATE'ing with multiple WHERES

So essentially I'm making a basic user online script with a timeout.
However, it doesn't seem to be working and I feel that my problem lies
within the UPDATE statement which updates a certain selection of
multiple 'WHERE's

The code:

UPDATE list SET on='1' WHERE user='$user' AND user_logged<$timeout

If anyone with some experience with this could take a look, much would
be appreciated.

Thanks!

Reply With Quote
  #2 (permalink)  
Old 11-09-2007
Rik Wasmus
 
Posts: n/a
Default Re: UPDATE'ing with multiple WHERES

On Fri, 09 Nov 2007 04:55:31 +0100, Austin Pickett <phragg@gmail.com>
wrote:

> So essentially I'm making a basic user online script with a timeout.
> However, it doesn't seem to be working and I feel that my problem lies
> within the UPDATE statement which updates a certain selection of
> multiple 'WHERE's
>
> The code:
>
> UPDATE list SET on='1' WHERE user='$user' AND user_logged<$timeout
>
> If anyone with some experience with this could take a look, much would
> be appreciated.


Query looks OK, no telling what $user & $timeout is substituted with
though. Display the raw query before you send it to MySQL, and check that
for errors. If you still don't get the desired result, provide some
testdata and a full query (i.e. $user & $timeout are substituted with the
actual values), and your desired result.
--
Rik Wasmus
Reply With Quote
  #3 (permalink)  
Old 11-09-2007
Captain Paralytic
 
Posts: n/a
Default Re: UPDATE'ing with multiple WHERES

On 9 Nov, 03:55, Austin Pickett <phr...@gmail.com> wrote:
> So essentially I'm making a basic user online script with a timeout.
> However, it doesn't seem to be working and I feel that my problem lies
> within the UPDATE statement which updates a certain selection of
> multiple 'WHERE's
>
> The code:
>
> UPDATE list SET on='1' WHERE user='$user' AND user_logged<$timeout
>
> If anyone with some experience with this could take a look, much would
> be appreciated.
>
> Thanks!


"it doesn't seem to be working"
Wow, very informative! In what bl**dy way doesn't it seem to be
working!
Is there a syntax error?
Is/are the wrong row/rows getting updated?
Is nothing getting updated?

How the h*ll do you expect anyone to be able to actually answer your
question when you don't even say what the problem is!!!!!

Think before you write!

Reply With Quote
Reply


Thread Tools
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

vB 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 10:03 AM.


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