RE: [PHP] Get the lowest value out of different fields
| From: | Chris W. Parker | Date: | Wed, 03 Sep 2003 19:28:11 +0000 |
| Subject: | RE: [PHP] Get the lowest value out of different fields | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-161584@lists.php.net to get a copy of this message | ||
Frank Keessen <mailto:fkeessen@planet.nl>
on Wednesday, September 03, 2003 12:14 PM said:
> I hope you can help me with this:
I hope so too!
> TEST
>
> fieldname Value's
>
> testid 1
> testf1 3
> testf2 4
> testf3 0
> testf4 2
> testf5 0
>
> (so this is one record!)
Waaahh? Please write out your table definition in a standard format.
Like this: (Doesn't have to be all fancy with the fancy characters, but
it should be horizontal and not vertical at the least.)
+--------+--------+--------+--------+--------+
| testid | testf1 | testf2 | testf4 | testf5 |
+--------+--------+--------+--------+--------+
| 1 | 3 | 4 | 0 | 2 |
+--------+--------+--------+--------+--------+
See how much easier that is to read? (And you don't have to label the
fieldname's or the value's.)
> I want to display the lowest value, except 0.. So the SQL statement
> will be SELECT testf1, testf2, testf3, testf4, testf5 FROM test where
> testid='1' .
Your query looks fine.
> I can't figure out if i can do this into a SQL statement or put it in
> an Array and sort it..
What do you mean you "can't figure out if i can do this into a SQL
statement"? You already did.
> Please help!
I'd really like to but I'm not sure what you want to do! Try explaining
it again please.
Chris.