Reverse
Moderator: General Moderators
-
Silver_Eclipse
- Forum Commoner
- Posts: 61
- Joined: Sun Aug 18, 2002 7:26 pm
Reverse
does anyone here know how i would print out something in reverse order?
say i have a list of numbers that is constantly getting larger, how would i print those numbers out from greatest to least instead of least to greatest?
(basically i have info in a database that is numbered and i need to print them all out but in reverse order)
say i have a list of numbers that is constantly getting larger, how would i print those numbers out from greatest to least instead of least to greatest?
(basically i have info in a database that is numbered and i need to print them all out but in reverse order)
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
-
Silver_Eclipse
- Forum Commoner
- Posts: 61
- Joined: Sun Aug 18, 2002 7:26 pm
Yeah works just fine now, thanks. Another question though, i have a login system setup using cookies, but even if they input an invalid username and password it still sends them a cookie and i have to set the cookies before i can do anything else. Is there a way to make it so that if they input an invalid name and pass then don't send the cookie?
-
Silver_Eclipse
- Forum Commoner
- Posts: 61
- Joined: Sun Aug 18, 2002 7:26 pm
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
Code: Select all
$qry = mysql_query("SELECT * FROM table WHERE username = '$username' AND password = '$password'");
if(mysql_num_rows($qry) == "1"){
setcookie();
} else {
echo "Invalid input";
}or use mysql_escape_string on all user input. May they type as much malicious input as they want 
-
Silver_Eclipse
- Forum Commoner
- Posts: 61
- Joined: Sun Aug 18, 2002 7:26 pm
yes but i have to useCode: Select all
$qry = mysql_query("SELECT * FROM table WHERE username = '$username' AND password = '$password'"); if(mysql_num_rows($qry) == "1"){ setcookie(); } else { echo "Invalid input"; }
Code: Select all
mysql_select_db("db1", $mysql);- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact: