View Single Post
Old 04-17-2008, 01:26 AM   #6 (permalink)
hcp
The Visitor
 
Join Date: Apr 2008
Posts: 3
Thanks: 0
hcp is on a distinguished road
Default

actually it's like this in my category table there is id column having rows with values like this
1
2
3
4
5
6
7
8
9
10

and in my details table there is category column having rows like this
2
2
2
2
6
6
6
6
4
4
4
8
8
8
10

and i did this
PHP Code:
$query "SELECT category.id, category.title, details.category ".
 
"FROM category, details".
        
"WHERE category.id = details.category ORDER BY category.id DESC LIMIT 5";
     
$result mysql_query($query) or die(mysql_error());


// Print out the contents of each row into a table 
while($row mysql_fetch_array($result)){
    echo 
$row['title']. " - "$row['category'];
    echo 
"<br />";

and the output is now like this

10
8
8
8
6

and that is what i wanted but it's continuing the same value if i don't do LIMIT 5 than it goes like this
10
8
8
8
6
6
6
6
4
4
4
2
2
2
2

all i want is to output like this without repeating any values like
10
8
6
4
2

please help
hcp is offline  
Reply With Quote