Ask a Question related to PHP Development, Design and Development.
-
Bob Bedford #1
Update from a select
PHP + MYSQL.
I've a table of articles in my database.
in this table they are 2 fields: CounterLogResult and CounterClick
Any user may search articles with some fields (a common search form). I
would like that every time the article is in the result of the query, the
CounterLogResult value is incremented. If the user click on the article (for
seeing the details of a result), the counterClick is incremented. I know how
to increment CounterClick (this is very easy), but how to increment
CounterLogResult ???
Something like:
Update Announce SET CounterLogResult = CounterLogResult+1 Where
Announce.IDArticle in (Select IDArticle FROM Article WHERE Article.price >
30 LIMIT 0,10);
That's because the select query for my page returns only 10 results at one
time. (in fact the Select is the same I use for showing the result of the
form fields).
BoB
Bob Bedford Guest
-
Can't select Acrobat Pro for update 8.1.2
Kristen or Anyone for the Matter, How the hair do I know which update to start with? I think I've downloaded every update and I still continue to... -
Select-And-Update in one statement?
On my site I often do SELECT counter from counters where id = 10 UPDATE counter set counter = counter + 1 Can I somehow merge them into one... -
Select, Edit, Update Issue
Hi, I have a datagrid with a Select, Edit, Update, and Cancel column. My problem is that when the grid gets filled, the first row automatically... -
update from select
Hi folks, don't know if it's cos of the 17 hours I've just worked (sympath vote please) but I can't get this one worked out I've got table... -
Update and Select Statement
Hi to all, I have VB application calling a SP. It works when: --return this to application SELECT * FROM tblVariance WHERE VarianceID =... -
Andy Hassall #2
Re: Update from a select
On Thu, 15 Jan 2004 18:46:00 +0100, "Bob Bedford"
<bedford1@YouKnowWhatToDohotmail.com> wrote:
Production versions of MySQL don't yet support subqueries, only the beta>PHP + MYSQL.
>
>I've a table of articles in my database.
>in this table they are 2 fields: CounterLogResult and CounterClick
>
>Any user may search articles with some fields (a common search form). I
>would like that every time the article is in the result of the query, the
>CounterLogResult value is incremented. If the user click on the article (for
>seeing the details of a result), the counterClick is incremented. I know how
>to increment CounterClick (this is very easy), but how to increment
>CounterLogResult ???
>
>Something like:
>Update Announce SET CounterLogResult = CounterLogResult+1 Where
>Announce.IDArticle in (Select IDArticle FROM Article WHERE Article.price >
>30 LIMIT 0,10);
>
>That's because the select query for my page returns only 10 results at one
>time. (in fact the Select is the same I use for showing the result of the
>form fields).
versions.
Execute the subquery separately then do an update per row returned.
--
Andy Hassall <andy@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>
Andy Hassall Guest



Reply With Quote

