Jump to content

a to z list


brown2005

Recommended Posts

No, sorry let me tell you again, i havnt explained it properly....

instead of

alfa.co.uk--------------------1000
bravo.co.uk-----------------500
charlie.co.uk----------------400
cabbage.co.uk----------------400
dikkins.co.uk----------------200

i want them listed like;

1000
alfa.co.uk

500
bravo.co.uk

400
charlie.co.uk
cabbage.co.uk

200
dikkins.co.uk
Link to comment
https://forums.phpfreaks.com/topic/9926-a-to-z-list/#findComment-37093
Share on other sites

I guess if you are talking of displaying , then it can be done with code on the front end. Something like this

[code]
<?php
//make db connection here

$query = "SELECT * FROM table XYZ order by hits desc";
$result = mysql_query($query) or die (mysql_error());
$num = mysql_num_rows($result);
$current_price = 0;
for($i=0;$i<$num;$i++) {
    $row = mysql_fetch_array($result);
    if($row['hits'] != $current_price) {
    echo $row['hits']."<br>";
    $current_price = $row['hits'];
    }
    echo $row['url']."<br>";
}
?>
[/code]

I have not tested this code, but should work.

hth

Link to comment
https://forums.phpfreaks.com/topic/9926-a-to-z-list/#findComment-37095
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.