|
-
Tiger Shark
php sorting through mysql *resulved*
how can i get my page to sort through data alphabeticly(sp) and with a limit on how many results it can display and then to top it off go to the next page of results if nessasary? i know how to do it in mysql but i dont know how to make a page out of this. can someone help me out?
Last edited by Muk108; 09-22-2003 at 04:22 PM.
WHy...why...
-
I've been trying to figure this out. I started looking through PhpMyAdmin's code. in sql.php I found:
PHP Code:
$sql_limit_to_append = " LIMIT $pos, ".$cfg['MaxRows'];
So I'm guessing it's something like:
PHP Code:
"SELECT * from users ORDER BY username LIMIT 11, 10"
I'm bout to go to bed or I would test it.
-
Tiger Shark
i know how to do it throught sql i just want the php for the users to choose what they want...
-
If that works then just use $_GET variables and set the limit with variables in the MySQL query. The MySQL query is the hard part.
-
Tiger Shark
would it be something like...
$sql = "select * from alumni ORDER BY alumni_name ASC WHERE(alumni_name BETWEEN " . "a"/*$_GET['ltr']*/ . " AND " ."a"/* $_GET['ltr'] */. ") LIMIT 0 , 20";
would it be something like that?
-
Tiger Shark
i found a better way of doing it....
PHP Code:
if ($sltr=="") {
if ($_GET['sltr']=="") {
$sltr = "a";
} else {
$sltr = $_GET['sltr'];
}
if ($_GET['eltr']=="") {
$eltr = "z";
} else {
$eltr = $_GET['eltr'];
}
$sql = "SELECT * FROM alumni WHERE(alumni_name BETWEEN '" . $sltr . "' AND '" . $eltr . "')" . "ORDER BY alumni_name ASC" ;
}
thanks for the input there. now just to get the page number display.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|