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

Display status from sql table

Hello Guys,

I really need your ideas on this one... Ok, I'm only familiar with php and simple html coding. I'm designing simple book loan database. Consist of two sql tables (a very simple one)

table 1
book_in

table 2
book_out


Ok.. Let say, every book is determined by a code. So anyone who borrow the book, they will key in the code and key in into another table when returning the book. I know that I can make a simple php/html table to show the status...

But I would prefer more friendly interface on the key in and key out form so no confusion (to avoid them key in twice). More or less, pop out status of the book..

In a simple page, will tell you the status of the book.. if the book is showing on the page, that means the book still unavailable (Still on loan)..

Any idea.. I can think of ajax or js... But I'm totally blank with those languages.. Any helps?

3
Contributors
5
Replies
7 Hours
Discussion Span
1 Year Ago
Last Updated
6
Views
trektrak
Junior Poster in Training
64 posts since Oct 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

From what I could gather, I think you basically need a system where users are able to check out books (like a library system). If that's the case you really only need one table as far as recording which books a user currently has checked out. For example the BOOKS_IN_USE table would contain the book ID and the person ID who has it checked out. You could then just display a list to the user where BOOKS_IN_USE.person_id = the current user's ID. If a person has a book in that table that means they currently have it checked out. Obviously you would need other tables for the book inventory and registered users but that's outside the scope of the question.

hag++
Junior Poster
197 posts since Jan 2010
Reputation Points: 34
Solved Threads: 31
Skill Endorsements: 0

Ok, at the moment I could display the status using a simple html php table... which will flood the page.. Maybe I need something more reliable to the user to check the status of the book... ermmm...

trektrak
Junior Poster in Training
64 posts since Oct 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

you only need one table and put status on books if it's still on loan, example 1=on loan, 0 = available

vaultdweller123
Posting Pro
574 posts since Sep 2009
Reputation Points: 47
Solved Threads: 81
Skill Endorsements: 2

Sorry... How Can i do That ? any sample?

trektrak
Junior Poster in Training
64 posts since Oct 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

1st you need to add additional field on book table, let's say the name of the field is 'status' data type is int, then it has two values, 1 = on loan, 0 = available, when someone borrow a book, then that book will have it's status updated also you should add another field for borrower.

vaultdweller123
Posting Pro
574 posts since Sep 2009
Reputation Points: 47
Solved Threads: 81
Skill Endorsements: 2

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

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0718 seconds using 2.7MB