Hi,
I've these values:
a) < 100 000 = 5 points
b) 100 000 - 250 000 = 4 points
c) > 250 000 = 3 points

``````\$a = 140000;
\$b = 23;

if (\$a > 250000)
{
\$b = 3;
echo \$b;
}

if ( 100000 < \$a <= 250000)
{
\$b = 4;
echo \$b;
}

if (\$a < 100000)
{
\$b = 5;
echo \$b;
}``````

the logic wrong here??????????????
if i put echo \$b outside of the if at the end of all the above if, does it store the value to \$b.

How to sort integer value from database,
example column values from maximum to minimum and the other way around?
I know how to find max or min value. and how to nicely put it in table so that it looks this way:

Item id item title item values
this will get value from db, from this will get value from db, from i'm not sure how to
query row + next row query row + next row do this part????

<table>
<tr>
for ( )
{
<td>Item id</td>
<td>item title</td>
<td>iteam value????</td>
}
</tr>
<table>

``````for (int i=0; i<10; i++)
{

if (number[i] > max) {
max=number[i];
}
if (number[i] < min) {
min=number[i];
}``````
2
Contributors
1
2
Views
10 Years
Discussion Span
Last Post by nav33n

Why not use order by clause in your query itself ?

``\$query = "select * from table order by colname [asc | desc ]";``

[asc | desc ] is optional. You can sort the records in ascending order or descending order on one or multiple columns.
Or, you can also fetch the records from the table into an array and sort the array and get the max or min value from it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.