Page 1 of 1

how to make something like this

Posted: Sun Jul 07, 2002 5:38 pm
by neliconcept
ok im trying to make a tutorials sectoin at my site and also keep 3 tutorials per page but i would like to make a some sort of database to make the tutorials go in alphabetical order or a-z z-a or most downloaded but keep 3 per page or 6 per page or 10 per page how would i do this?

Posted: Sun Jul 07, 2002 7:15 pm
by cheatboy00
you would somehow have to check each character in the title....

try seaching in the php manul for somethign anlong the lines of strchr or somethign like that

...

Posted: Sun Jul 07, 2002 9:27 pm
by QWERTY
Try with SQL (ORDER BY field_with_title ASC / DESC)...
I don't now if it will work, but you can try...

Posted: Mon Jul 08, 2002 2:25 am
by neliconcept
well im a newb so i dont know what you are really talking about since i only did my site in php the easy php thats all i really know

Posted: Mon Jul 08, 2002 3:11 am
by twigletmac
I would check out a few tutorials, try places like: As you've discovered, it's difficult to get help if you don't understand the answers. A few tutorials should help you get your database started and then if you have problems feel free to come back here and ask.

Mac

Re: how to make something like this

Posted: Mon Jul 08, 2002 4:04 am
by ajaypatil
neliconcept wrote:ok im trying to make a tutorials sectoin at my site and also keep 3 tutorials per page but i would like to make a some sort of database to make the tutorials go in alphabetical order or a-z z-a or most downloaded but keep 3 per page or 6 per page or 10 per page how would i do this?
Make a table called Tutorials, which as columns like:
- ID, Name, Summary, Download_Count, Content.

Then You can write a PHP Script -
ViewTutorials.php

Inside ViewTutorials.php write code like:

Code: Select all

$sql = "SELECT Content FROM Tutorials 
           ORDER BY $sort_key $sort_order
           LIMIT $start_row, $tutorials_perpage";
$sort_key, $sort_order, $start_row and $row_count are
POST or GET Variables.

$sort_key equals to "Name" or "Download_Count".
$asc equals to "ASC" or "DESC" (ASC is a-z. DESC is z-a)
$tutorials_perpage can be 3,6 or 10.
$start_row is initialized to 0, and then subsequently incremented/
decremented for each next or previous link.

You can display the results from the above query on your
page. You can then give the Previous and next links like follows:

Code: Select all

<?php  
$next_row       = $start_row + $row_count;
$previous_row = $start_row - $row_count;

// Hyperlink to Next tutorials
echo "<a href="ViewTutorials.php?sort_key=$sort_key&sort_order=$sort_order&start_row=$next_row&row_count=$row_count">Next $row_count Tutorials</a>";

// Hyperlink to Previous Tutorials
echo "<a href="ViewTutorials.php?sort_key=$sort_key&sort_order=$sort_order&start_row=$previous_row&row_count=$row_count">Previous $row_count Tutorials</a>";

// Hyperlink to view Tutorials a-z
echo "<a href="ViewTutorials.php?sort_key=Name&sort_order=ASC&start_row=0&row_count=$row_count">Tutorials a-z</a>";

// Hyperlink to view Tutorials z-a
echo "<a href="ViewTutorials.php?sort_key=Name&sort_order=DESC&start_row=0&row_count=$row_count">Tutorials a-z</a>";

// Hyperlink to view Tutorials Top-Downloaded
echo "<a href="ViewTutorials.php?sort_key=Download_Count&sort_order=DESC&start_row=0&row_count=$row_count">Top downloaded Tutorials</a>";
Hope you can get this working pretty fast now and above was
exactly what you were looking for.

:lol:
Ajay