Jump to content

Sort by Alphabet with....


phpSensei

Recommended Posts

Here is my code thats above my <head> lol, not that way...

 

<?php include("connection.php");?>

<?php 

$sql="SELECT * FROM linklist"; //Linklist Contains movie titles and name
$query= mysql_query($sql);

?>

 

Then I have a table that lists all the movie names, but I want the movie names to be sorted by order from #-z...

 

So I did this and it doesnt work

 


<?php
while ($data = mysql_fetch_assoc ($query) ){ // Here we retrieve the query from previously and make it into an array//

asort($row['list_title']); // I fetch the name of the movies from the array I just created and I sort it..i think//
echo $row['list_title'];

}

?>

 

Someone help me with this damn code, and how do you sort everthing?

Link to comment
https://forums.phpfreaks.com/topic/62569-sort-by-alphabet-with/
Share on other sites

THANKS, I knew that but I just thought it starts from one row and goes down...

 

Does it do the same for dates?

 

One more question lol : How would you make it so everytime a new movie is added, there is a list like this:

 

1.300 the movie

2.cool movie

3.something

4.

5.

6.

7.

8.

 

And when a new movie is added, 300 goes down to number 2 and is replace with the new movie, and so on so on....

 

1.new movie

2.300

3.cool movie

4.something

6.

7.

8.

9.

 

???

 

Link to comment
https://forums.phpfreaks.com/topic/62569-sort-by-alphabet-with/#findComment-311425
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.