We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,624 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

database if statement problem in ruby

hi everyone, i need to print error message if ID is greater than 1 and log user in if username is correct and display error message if the username is wrong.
the code print error message if id is greater than 1 and it authenticates user if correct username is entered but does no display error message is wrong username is entered rather, it dispalys empty page. any help

if id > '1'
puts 'your id is greater than 1'
# working
elsif username == 'mutago'
puts 'login' 
#working

else 
puts "wrong username"
#here is the problem not working rather dispalys empty page
end
2
Contributors
1
Reply
1 Day
Discussion Span
1 Year Ago
Last Updated
2
Views
monica23
Newbie Poster
9 posts since Jun 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Your probably mean to do something along the lines of if id > 1 instead of if id > '1' .
Notice the lack of single quotes in the first example.

L7Sqr
Practically a Posting Shark
849 posts since Feb 2011
Reputation Points: 253
Solved Threads: 155
Skill Endorsements: 7

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.2981 seconds using 2.65MB