Re: [PHP] Re: How do you update multiple rows at the same time?

2003-01-27 Thread Richard Whitney
Steve!

Could you be more specific and send some code you are using (even if it doesn't
work).  It may give some insight as to your specific need.

That said, as far as I can tell, what you are trying to accomplish is this:

$sql = "UPDATE tablename SET 1column = '$newvariable' WHERE 1column =
'$oldvariable'";

This will effectively update any number of rows that match the criteria.

Maybe you are trying to update rows where 1column values don't match?  If so,
you may need to run multiple queries.

It's late and I'm guessing.  Good Luck!

RW


Quoting Max Tappenden <[EMAIL PROTECTED]>:

### You on MySQL?
### If so do this
### UPDATE tblName SET firstcol = '$var41stcol', $secondcol = '$var42ndcol'
### and so on
### "Steve Jackson" <[EMAIL PROTECTED]> wrote in message
### 01c2c3a0$27591b50$[EMAIL PROTECTED]">news:01c2c3a0$27591b50$[EMAIL PROTECTED]...
### > I am having trouble with this.
### > I need to update 1column in a variable number of rows depending on how
### > many categories are in my database at a given time.
### >
### > Can anyone provide any pointers or example code
### >
### >
### > Steve Jackson
### > Web Developer
### > Viola Systems Ltd.
### >   http://www.violasystems.com
### > [EMAIL PROTECTED]
### > Mobile +358 50 343 5159
### >
### >
### >
### >
### >
### 
### 
### 
### -- 
### PHP General Mailing List (http://www.php.net/)
### To unsubscribe, visit: http://www.php.net/unsub.php
### 
### 


-- 
Richard Whitney
Transcend Development
Producing the next phase of your internet presence.
[EMAIL PROTECTED]
http://xend.net
602-971-2791

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: How do you update multiple rows at the same time?

2003-01-26 Thread Max Tappenden
You on MySQL?
If so do this
UPDATE tblName SET firstcol = '$var41stcol', $secondcol = '$var42ndcol'
and so on
"Steve Jackson" <[EMAIL PROTECTED]> wrote in message
01c2c3a0$27591b50$[EMAIL PROTECTED]">news:01c2c3a0$27591b50$[EMAIL PROTECTED]...
> I am having trouble with this.
> I need to update 1column in a variable number of rows depending on how
> many categories are in my database at a given time.
>
> Can anyone provide any pointers or example code
>
>
> Steve Jackson
> Web Developer
> Viola Systems Ltd.
>   http://www.violasystems.com
> [EMAIL PROTECTED]
> Mobile +358 50 343 5159
>
>
>
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: How do you update multiple rows at the same time?

2003-01-24 Thread Brian Burg
first.. you need to find the number of categories in
the table.. Use a simple MySQL function for that.
Example:

mysql> SELECT `table.categoryfield`, COUNT(*) FROM
`table` GROUP BY `table.categoryfield`;

this will return each category, and how many rows use
this category. Example:

+-++
| table.categoryfield | table.COUNT(*) |
+-++
|   Category1 |  14356 |
|   Category2 | 34 |
|   Category3 |343 |
+-++

or if you just want the plain number of categories,
use COUNT(*). Example:

SELECT COUNT(DISTINCT table.categoryfield) FROM
`table`;

which returns a single element, the number of unique
categories.

I hope this may help you!

Regards,

Brian Burg
Hudsonville Web Design Team
http://www.hudsonville.k12.mi.us


__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php